Closed sq6sfo closed 6 years ago
Can You give an example of use (format of serial)? How do You get serials of STLInks? For the moment I use st-info --probe from texane st-link. Btw.:
patch -p1 <multiple.diff patching file main.c patching file stm8flash
but
cc -g -O0 --std=gnu99 --pedantic
pkg-config --cflags libusb-1.0` -c -o main.o main.c
main.c: In function ‘usb_init’:
main.c:196:30: error: ‘i’ undeclared (first use in this function)
if(pgm_serial_specified && i==cnt) {
^
main.c:196:30: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:201:2: error: expected identifier or ‘(’ before ‘else’
else
^
main.c:209:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘->’ token
pgm->ctx = ctx;
^
main.c:210:2: error: expected identifier or ‘(’ before ‘if’
if (!pgm->dev_handle) spawn_error("Could not open USB device.");
^
main.c:213:32: error: expected ‘)’ before numeric constant
libusb_free_device_list(devs, 1); //free the list, unref the devices in it
^
main.c:215:2: error: expected identifier or ‘(’ before ‘if’
if(libusb_kernel_driver_active(pgm->dev_handle, 0) == 1) { //find out if kernel driver is attached
^
main.c:225:2: error: expected identifier or ‘(’ before ‘return’
return(true);
^
main.c:226:1: error: expected identifier or ‘(’ before ‘}’ token
}
^
As far as I know st-info uses similar format of the serial number. Basically I'm using the iSerialNumber string from libusb device descriptor. I then directly print the char values in hexadecimal uppercase format (some characters in iSerialNumber string are not printable and would be hard to copy-paste). Example serial of my stlink-v2-clone: 543F7206757757493431123F
@PanKaczka I think that's the case:
else **//<-- no { here**
// otherwise check if it's the correct one
if(0==strcmp(serial_hex, pgm_serial)) {
pgm->dev_handle = tempHandle;
break;
}
}
Support for multiple programmers has been merged.
Philipp
Currently stm8flash is using libusb_open_device_with_vid_pid function that returns handle to the first device that match vID and pID. I've created a simple patch that adds -S option that allows for specifying the desired programmer. I have some difficulties creating pull-request so feel free to use my change if you find it useful.
I can also confirm the tool works flawlessly for target stm8l151?6 (STML151G6 in my case) multiple.diff.gz