On Sun, Jul 17, 2011 at 4:26 AM, Uwe Bonnes <[email protected]> wrote: >>>>>> "Ale" == Ale Max <[email protected]> writes: > > Ale> I do support this proposal. I currently dont have libusb-1.0 > Ale> installed only the < 1.0 version so I haven't tested Xiaofan's > Ale> suggestion. > > libusb-0 doesn't support to re-attach, so we can't implement this feature on > libftdi-0. >
It can still be done with usbfs under Linux if you really want to do that. After all, libusb-0.1 is a thin wrapper on top of usbfs under Linux. libusb-1.0 is also a wrapper on top of usbfs under Linux, not as thin as libusb-0.1 though. Example from libgphoto2 which is still using libusb-0.1. http://gphoto.svn.sourceforge.net/viewvc/gphoto/trunk/libgphoto2/libgphoto2_port/usb/libusb.c?revision=13663&view=markup 337 #if defined(LIBUSB_HAS_GET_DRIVER_NP) && defined(LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP) && defined(USBDEVFS_CONNECT) 338 if (port->pl->detached) { 339 char filename[PATH_MAX + 1]; 340 int fd; 341 342 /* FIXME shouldn't be a fixed path to usb root */ 343 snprintf(filename, sizeof(filename) - 1, "%s/%s/%s", "/dev/bus/usb", port->pl->d->bus->dirname, port->pl->d->filename); 344 fd = open(filename, O_RDWR); 345 346 if (fd >= 0) { 347 struct usbdevfs_ioctl command; 348 command.ifno = 0; 349 command.ioctl_code = USBDEVFS_CONNECT; 350 command.data = NULL; 351 if (ioctl(fd, USBDEVFS_IOCTL, &command)) 352 gp_log (GP_LOG_DEBUG,"libusb","reattach kernel driver failed"); 353 close(fd); 354 } 355 } 356 #endif -- Xiaofan -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
