On Sat, Nov 17, 2012 at 8:19 PM, Hans Petter Selasky <hsela...@c2i.net> wrote:
> On Friday 16 November 2012 23:47:29 Wojciech A. Koszek wrote:
>> >Number:         173666
>> >Category:       usb
>> >Synopsis:       [USB, LIBUSB] usb_reset() behavior different between
>> >GNU/Linux and FreeBSD Confidential:   no
>> >Severity:       non-critical
>> >Priority:       low
>> >Responsible:    freebsd-usb
>> >State:          open
>> >Quarter:
>> >Keywords:
>> >Date-Required:
>> >Class:          sw-bug
>> >Submitter-Id:   current-users
>> >Arrival-Date:   Fri Nov 16 22:50:00 UTC 2012
>> >Closed-Date:
>> >Last-Modified:
>> >Originator:     Wojciech A. Koszek
>> >Release:        9.0-RELEASE
>> >Organization:
>> FreeBSD
>> >Environment:
>> FreeBSD seu 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC
>> 2012     r...@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>> >Description:
>> I have a driver written for libusb, which works fine under GNU/Linux and
>> libusb. Device:
>> gen0.2: <JSB283 Relay Module J-Works,Inc> at usbus0, cfg=0 md=HOST spd=LOW
>> (1.5Mbps) pwr=ON
>> (I used USB sniffer to uncover traffic based on what Windows was doing)
>> Under Linux usb_reset()+usb_set_configuration() calls works fine. Under
>> FreeBSD I have to disable calling usb_reset(), otherwise
>> usb_set_configuration() fails with I/O error.
> According to:
> http://libusb.sourceforge.net/doc/function.usbreset.html
> What you describe is the expected behaviour.

The above document is really meant for libusb-0.1 but the
behavior of libusb-compat's usb_reset() is different since
it is based on libusb-1.0's libusb_reset_device.

 743 API_EXPORTED int usb_reset(usb_dev_handle *dev)
 744 {
 745         usbi_dbg("");
 746         return compat_err(libusb_reset_device(dev->handle));
 747 }

For libusb-1.0 under Linux and Mac OS X, usually
 libusb_reset_device will not cause enumeration.



int libusb_reset_device (       libusb_device_handle *  dev     )       
Perform a USB port reset to reinitialize a device.

The system will attempt to restore the previous configuration and
alternate settings after the reset has completed.

If the reset fails, the descriptors change, or the previous state
cannot be restored, the device will appear to be disconnected
and reconnected. This means that the device handle is no longer
valid (you should close it) and rediscover the device. A return code
of LIBUSB_ERROR_NOT_FOUND indicates when this is the case.

This is a blocking function which usually incurs a noticeable delay.

   dev    a handle of the device to reset
   0 on success
   LIBUSB_ERROR_NOT_FOUND if re-enumeration is required, or if the
      device has been disconnected
   another LIBUSB_ERROR code on other failure

freebsd-usb@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-usb-unsubscr...@freebsd.org"

Reply via email to