﻿ticket,summary,type,owner,status,created,_changetime,_description,_reporter
32,Make libusb-compat-0.1 easier to build for Windows,enhancement,,new,2010-02-20T03:27:06+01:00,2012-05-05T15:56:56+02:00,"Right now it is difficult to build libusb-compat-0.1 under Windows. It would be great to provide the right configure scripts for MinGW/Cygwin and Visual C++ projects files. By doing this, libusb 1.0 Windows backends may appeal to more users and this will help the testing of libusb 1.0 Windows backends (WinUSB and HID currently).

Reference thread:
http://old.nabble.com/libusb-compat-for-the-libusb-1.0-Windows-backend-td27292398.html",xiaofan
42,Error return code of usb_detach_kernel_driver_np(),defect,sbrabec,closed,2010-05-18T15:41:00+02:00,2012-04-24T07:48:25+02:00,"For usb_detach_kernel_driver_np(), the compat layer will return ENOENT (for LIBUSB_ERROR_NOT_FOUND) instead of ENODATA which is the value returned by libusb-0.1.

From libusb-1.0 (linux_usbfs.c)
static int op_detach_kernel_driver(struct libusb_device_handle *handle,
       int interface)
{
       int fd = __device_handle_priv(handle)->fd;
       struct usbfs_ioctl command;
       int r;

       command.ifno = interface;
       command.ioctl_code = IOCTL_USBFS_DISCONNECT;
       command.data = NULL;

       r = ioctl(fd, IOCTL_USBFS_IOCTL, &command);
       if (r) {
               if (errno == ENODATA)
                       return LIBUSB_ERROR_NOT_FOUND;
               else if (errno == EINVAL)
                       return LIBUSB_ERROR_INVALID_PARAM;
               else if (errno == ENODEV)
                       return LIBUSB_ERROR_NO_DEVICE;

               usbi_err(HANDLE_CTX(handle),
                       ""detach failed error %d errno %d"", r, errno);
               return LIBUSB_ERROR_OTHER;
       }

       return 0;
}

From original libusb-0.1: it is similar to libusb-1.0, so it
can return ENODATA, EINVAL and ENODEV.

int usb_detach_kernel_driver_np(usb_dev_handle *dev, int interface)
{
 struct usb_ioctl command;
 int ret;

 command.ifno = interface;
 command.ioctl_code = IOCTL_USB_DISCONNECT;
 command.data = NULL;

 ret = ioctl(dev->fd, IOCTL_USB_IOCTL, &command);
 if (ret)
   USB_ERROR_STR(-errno, ""could not detach kernel driver from
interface %d: %s"",
       interface, strerror(errno));

 return 0;
}

From libusb-0.1-compat:

static int libusb_to_errno(int result)
{
       switch (result) {
       case LIBUSB_SUCCESS:
               return 0;
       case LIBUSB_ERROR_IO:
               return EIO;
       case LIBUSB_ERROR_INVALID_PARAM:
               return EINVAL;
       case LIBUSB_ERROR_ACCESS:
               return EACCES;
       case LIBUSB_ERROR_NO_DEVICE:
               return ENXIO;
       case LIBUSB_ERROR_NOT_FOUND:
               return ENOENT;
       case LIBUSB_ERROR_BUSY:
               return EBUSY;
       case LIBUSB_ERROR_TIMEOUT:
               return ETIMEDOUT;
       case LIBUSB_ERROR_OVERFLOW:
               return EOVERFLOW;
       case LIBUSB_ERROR_PIPE:
               return EPIPE;
       case LIBUSB_ERROR_INTERRUPTED:
               return EINTR;
       case LIBUSB_ERROR_NO_MEM:
               return ENOMEM;
       case LIBUSB_ERROR_NOT_SUPPORTED:
               return ENOSYS;
       default:
               return ERANGE;
       }
}

API_EXPORTED int usb_detach_kernel_driver_np(usb_dev_handle *dev, int interface)
{
       return compat_err(libusb_detach_kernel_driver(dev->handle, interface));
}",xiaofan
113,compatibilty wrapper doesn work with keylok dongles.,defect,,closed,2011-07-15T14:47:30+02:00,2012-04-21T07:56:55+02:00,"The Arch Linux distro uses the compat wrapper to provide a libusb-0.1 interface.  Using a keylok dongle and its test programs I am able to run single manual commands on the dongle.  However when I move over to trying to use the dongle in a real program the program stalls and sometimes crashes in the pthread libraries.  I believe I've traced it down to the asynchronous handling of the dongles.  Of course I can't debug the access very well since the dongle manufacturer makes it a point to *not* allow snooping on their devices.

Btw, dropping back to the original libusb-0.1 libraries works just fine.",bnolsen
130,libusb-compat-0.1 does not call libusb_exit(),defect,stuge,closed,2012-05-05T15:48:18+02:00,2013-05-22T20:26:04+02:00,"There is a potential problem in the libusb-compat layer because libusb-1.0
requires a call to libusb_exit().  However, libusb_exit() is never called by the
compat layer even though libusb_init() is used.
http://git.libusb.org/?p=libusb-compat-0.1.git;a=blob;f=libusb/core.c;js=1

Also ref here which shows that libusb_exit() is really necessary.
http://libusb.6.n5.nabble.com/quot-memory-leak-quot-debug-message-after-libusb-close-and-upon-application-exit-td5581475.html",xiaofan
135,libusb-compat-0.1  examples/Makefile.am problem,defect,xiaofan,closed,2012-06-06T01:43:55+02:00,2012-07-29T07:04:34+02:00,"There is a problem examples/Makefile.am and here is the patch.

http://libusb.6.n5.nabble.com/PATCH-libusb-compat-0-1-examples-Link-only-with-libusb-libusb-la-and-not-with-lusb-tp5708125.html
",xiaofan
138,libusb-compat-0.1.4 fails to compile against libusbx-1.0.12 (debug function related),defect,,closed,2012-07-01T22:32:03+02:00,2012-07-01T23:57:04+02:00,"Downstream bug report:

http://bugs.gentoo.org/423135

I'll add a patch (but it has no #ifdef magic, and it should for backwards compability).

Fixed also here (Found this by accident by Google):

http://web.archiveorange.com/archive/v/7gAIOz6h5eQ6JqaE2l4f

By:

sed -i '/^enum usbi_log_level/,/^}\;$/d' libusb/core.c",ssuominen
141,sispmctl -s crashes on usb startup,defect,,new,2012-07-19T00:22:39+02:00,2012-07-19T00:28:30+02:00,"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.
{{{
  usb_init();
  usb_find_busses();
  usb_find_devices();
  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);
        break;
      }
    }
  }

  /* 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));
      usb_close(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.",vielleicht
149,Correction for libusb-compat's pkg-config file with static linking,defect,stuge,closed,2012-08-24T21:02:07+02:00,2013-05-22T20:26:44+02:00,"libusb-compat's current pkg-config has a mistake which results in an improper pkg-config file for static linking. The attached patch adds a Requires.private entry
to the pkg-config to correct the static linking.",brad
161,Build with automake-1.13 broken,defect,stuge,closed,2013-01-05T03:44:11+01:00,2013-05-22T20:27:10+02:00,"http://libusb.org/ticket/159

Automake-1.13 removed long obsolete AM_CONFIG_HEADER completely 
( ​http://lists.gnu.org/archive/html/automake/2012-12/msg00038.html ) and errors out upon seeing it.

That ticket has a patch to replace AM_CONFIG_HEADER with AC_CONFIG_HEADERS and it will work here as well.",xiaofan
