Ticket #141 (new defect)

Opened 5 years ago

Last modified 5 years ago

sispmctl -s crashes on usb startup

Reported by: vielleicht Owned by:
Milestone: Component: libusb-compat-0.1
Keywords: libusb-compat-0.1.4-2 libusb-1.0.12-2 sispmctl arch linux Cc:
Blocked By: Blocks:


Sispmctl is using libusb-compat and fails on scanning for available devices. After searching for the source, I think, some error handling is wrong. The program is exiting with the following error:
USB set configuration No such file or directory
and referes to
ioctl(6, USBDEVFS_SETCONFIGURATION, 0x7fffb1f1aafc) = -1 EINVAL (Invalid argument)

When looking at the source of sispmctl (current version 3.1) and the attached 'strace sispmctl -s' makes me think, that either usb_init(), usb_find_busses() or usb_find_devices() is buggy. The first position I would search for is the usb_find_busses, because when looking at the strace only /sys/bus/ directories are listed.

  for (bus = usb_busses; bus; bus = bus->next) {
    for (dev = bus->devices; dev; dev = dev->next) {
      if ((dev->descriptor.idVendor == VENDOR_ID) && ((dev->descriptor.idProduct == PRODUCT_ID_SISPM) ||
                                                      (dev->descriptor.idProduct == PRODUCT_ID_MSISPM_OLD) ||
                                                      (dev->descriptor.idProduct == PRODUCT_ID_MSISPM_FLASH) ||
                                                      (dev->descriptor.idProduct == PRODUCT_ID_SISPM_FLASH_NEW))) {
        usbdev[count++] = dev;
      if (count == MAXGEMBIRD) {
        fprintf(stderr,"%d devices found. Please recompile if you need to support more devices!\n",count);

  /* bubble sort them first, thnx Ingo Flaschenberger */
  if (count > 1) {
    do {
      found = 0;
      for (i=1; i< count; i++) {
        if (usbdev[i]->devnum < usbdev[i-1]->devnum) {
          usbdevtemp = usbdev[i];
          usbdev[i] = usbdev[i-1];
          usbdev[i-1] = usbdevtemp;
          found = 1;
    } while (found != 0);

  /* get serial number of each device */
  for (i=0; i < count; i++) {
    usb_dev_handle *sudev = NULL;

    sudev = get_handle(usbdev[i]);
    if (sudev == NULL) {
      fprintf(stderr, "No access to Gembird #%d USB device %s\n",
              i, usbdev[i]->filename );
      usbdevsn[i] = malloc(5);
      usbdevsn[i][0] = '#';
      usbdevsn[i][1] = '0'+i;
      usbdevsn[i][2] = '\0';
    else {
      usbdevsn[i] = strdup(get_serial(sudev));
      sudev = NULL;

My system is running libusb-compat-0.1.4-2 using libusb-1.0.12-2. The Archlinux is up-to-date.

> uname -a
Linux rhabarberstrauch 3.4.4-3-ARCH #1 SMP PREEMPT Tue Jul 3 14:36:44 UTC 2012 x86_64 GNU/Linux

When I unplug and replug the gembird device, the problem is gone away. But it reoccurs after short random time.

I have attached the output of an 'strace sispmctl -s'. Hopefully you can locate the bug and fix it.


strace sispmctl s.txt (51.8 KB) - added by vielleicht 5 years ago.
'strace sispmctl -s'

Download all attachments as: .zip

Change History

Changed 5 years ago by vielleicht

'strace sispmctl -s'

comment:1 Changed 5 years ago by stuge

Arch switched to use the libusbx fork instead of libusb. There is no libusb-1.0.12 version. I guess they too didn't change the package name.

Neither the source code you included nor the strace shows any obvious error; the application attempts to set a configuration and gets a reply from the kernel that the requested configuration does not exist.

Please include more information in order to get some more useful analysis. lsusb -v for the device, and/or contents of /sys/kernel/debug/usb/devices after mounting a debugfs, and/or a libusb-1.0.9 debug log.


Note: See TracTickets for help on using tickets.