On Tue, Dec 06, 2016 at 05:22:20PM +0100, Martin Pieuchot wrote:
> On 06/12/16(Tue) 16:40, Patrick Wildt wrote:
> > [...] 
> > blink1 uses libusb-compat to talk to a USB device that speaks hid.  I
> > have come to realize that the usage of libusb by blink1 makes libusb
> > send 4 packets to each connected USB device when it tries to find which
> > USB devices are connected.
> 
> That's a bug in libusb/kernel interface and should be fixed.  libusb1
> properly documents which functions MUST NOT generate traffics, and we
> do not respect that.
> 
> > [...] I have USB sticks that abort operation as
> > soon as they receive a "get config descriptor" while doing block read/
> > write operations.  This means that EHCI transfers time out and might
> > even throw a panic, simply by calling blink1-tool.
> > 
> > Instead of using and depending on libusb (especially the old "compat"
> > version) I propose to change blink1 to talk to USB hid devices only
> > through uhid(4).  This has the benefits that we don't depend on libusb,
> > only talk to uhid(4) devices and not _all_ USB devices, don't stress the
> > USB bus, and simplify the implementation.  Unfortunately this means we
> > implement another backend (that can probably be used my more BSDs).
> 
> Basically what you say is "let's not fix the bugs in libusb and keep the
> old unused interface".  I disagree with this approach.  libusb *is* a
> standard so better fix and improve it rather that work around it.
> 
> Improving libusb1 will result in better USB support for everybody.
> 

I fully agree that libusb has to be fixed.

blink(1) still uses the libusb-compat library in the hiddata backend.
The hiddata backend is supposedly only for low resource linuxes.  The
better backend would be hidapi, which uses libusb1 directly.  But that
doesn't work either (for other reasons, apart from the original).

I needed this bug workarounded right now, so this was the easiest
solution for now to share and talk about.  At least now I know that
you think uhid(4) should be gone completely and libusb is the way to
go.  Which means I have a workaround for now, but will throw away this
diff and concentrate on debugging blink1 with the hidapi backend in
combination with libusb.  Good.

Patrick

Reply via email to