20

I seem tangled between different abstractions on the USB stack.. what is the difference betweeen IOCTL_USB_RESET and USBDEVFS_RESET fired against an USB device? Will both calls finally trigger the same low level actions on the interface, or is there a difference?

I noticed that USBDEVFS_RESET is sometimes described with 'equivalent of replugging and reenumerating the device', while I found by myself that firing IOCTL_USB_RESET (as done by libusb's usb_reset() call) does trigger a reset message in dmesg but no new 'enumeration', which would lead to the usual multi-line USB detection and identification messages I guess.

As IOCTL_USB_RESET is not feasable to solve my problems (stuck up usb devices), and even does not trigger reenumeration, is there any chance USBDEVFS_RESET would do better?

dronus
  • 10,774
  • 8
  • 54
  • 80

1 Answers1

2

I think you talk about IOCTL_USBFS_RESET instead of IOCTL_USB_RESET?

IOCTL_USBFS_RESET is specific to libusb. Indeed, libusb does not use structures nor ioctls defined in usbdevice_fs.h. Instead it redefine everything in os/linux_usbfs.h (I think for historical reasons). These two headers are binary compatible but, libusb does not use same names for structures and ioctls. For structures, prefix usbdevfs_ is replaced with usbfs_ (usbfs_ctrltransfer, usbfs_bulktransfer, ...). For ioctls, prefix USBDEVFS_ is replaced by IOCTL_USBFS_.

So, indeed, IOCTL_USBFS_RESET is the same than USBDEVFS_RESET (= _IO('U', 20)).

Jérôme Pouiller
  • 9,249
  • 5
  • 39
  • 47