You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stlink_t *stlink_open_usb(...) {
line 1144:
// TODO: Reading a environment variable in a usb open function is not very nice, this should
// be refactored and moved into the CLI tools, and instead of giving USB_BUS:USB_ADDR a real
// stlink serial string should be passed to this function. Probably people are using this
// but this is very odd because as programmer can change to multiple busses and it is better
// to detect them based on serial.
char *device = getenv("STLINK_DEVICE");
Here supposed that there is an environment variable in user system with name "STLINK_DEVICE" and value "Device_bus:Device_Address". In case of presence such variable in user system function gets device bus and device address from USB devices list and compare them with ones in environment variable. If do not match then proceed with next USB device from list.
There is no such variable in my system. I can not find any place in code which set this variable. Function stlink_open_usb gets serial of ST-LINK in 3rd parameter and uses it to find right USB device. So may it be useful to completely remove all code which works with getenv function and variables device, devBus and devAddr?
The text was updated successfully, but these errors were encountered:
In general it is favourable to do so if there is no remaining use within the codebase.
However this must be assured for all platforms.
Please note that no further refactoring should take place until the chip-id reading has been finally rewritten.
All old bindings need to be replaced and switched to new structure.
Nightwalker-87
changed the title
usb.c refactoring request: can we remove some unused code?
usb.c refactoring request: Can we remove some unused code?
Jan 6, 2022
Nightwalker-87
changed the title
usb.c refactoring request: Can we remove some unused code?
[refactoring] usb.c: Can we remove some unused code?
Jan 6, 2022
In usb.c there are next lines:
Here supposed that there is an environment variable in user system with name "STLINK_DEVICE" and value "Device_bus:Device_Address". In case of presence such variable in user system function gets device bus and device address from USB devices list and compare them with ones in environment variable. If do not match then proceed with next USB device from list.
There is no such variable in my system. I can not find any place in code which set this variable. Function stlink_open_usb gets serial of ST-LINK in 3rd parameter and uses it to find right USB device. So may it be useful to completely remove all code which works with getenv function and variables device, devBus and devAddr?
The text was updated successfully, but these errors were encountered: