Serasidis / STM32_HID_Bootloader

Driverless USB HID bootloader and flashing tool for STM32F10X devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coredump in CLI upload tool (Linux, Ubuntu)

Boregard opened this issue · comments

CLI tool cores when the user does not have the correct access rights for the HID device (as is default).
Reason is that:
handle = hid_open(VID, PID, NULL);
returns NULL in that case, since hid_open in hid-libusb.c silently swallows the return code from libusb and returns NULL.
Quick fix is to add a check, like:
printf("\n> 1209:BEBA device is found !\n");

handle = hid_open(VID, PID, NULL);

if(!handle || i == 10){
printf("\n> Unable to open the HID device.\n");
error = 1;
goto exit;
}

For getting correct access rights I added device in udev setup, maybe that should be mentioned in README.md