larskanis/libusb

Error on windows

perryn opened this issue · 2 comments

Hello

I am trying to update my blinky gem (https://github.com/perryn/blinky) to use the your libusb gem as a way of getting windows support that actually works.

Unfortunately everything works great on OSX, but I am still having trouble on windows.

I am trying to use a Delcomm USB light on Windows 7
- when I plug in the light it detected it and automatically installed a driver
- as a result Zadig didn't recognize any devices that needed drivers (and the full list didn't seem to contain anything that looked replaceable)

So I thought maybe the driver it automagically installed might work - and indeed my gem is able to detect the light - but if I try to send it a command I get this:

LIBUSB::ERROR_INVALID_PARAM: LIBUSB::ERROR_INVALID_PARAM in libusb_submit_transfer
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/libusb-0.2.2-x86-mingw32/lib/libusb/constants.rb:46:in `raise_error'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/libusb-0.2.2-x86-mingw32/lib/libusb/transfer.rb:135:in `submit!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/libusb-0.2.2-x86-mingw32/lib/libusb/transfer.rb:162:in `submit_and_wait!'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/libusb-0.2.2-x86-mingw32/lib/libusb/dev_handle.rb:390:in `control_transfer'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/libusb-0.2.2-x86-mingw32/lib/libusb/compat.rb:316:in `usb_control_msg'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/blinky-0.0.4/lib/device_recipes/delcom_engineering/visual_indicator_gen_two.rb:28:in `set_colour'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/blinky-0.0.4/lib/device_recipes/delcom_engineering/visual_indicator_gen_two.rb:7:in `success!'
        from (irb):5
        from C:/Ruby193/bin/irb:12:in `<main>

any pointers would be grafefully received.

and a few minutes later I have got it working. It did indeed seem to be that the driver Windows "helpfully" installed was for a 'USB Input Device' - I used Zadig to replace this and it started working.

Good idea to change to libusb.gem :) and great that it works!

Yes it is annoying that windows always installs it's own driver for such devices. You always have to use Zadig or manually update the driver by selecting the Zadig-generated ini-file in the device manager.