gem install libusbThis gave me libusb-0.3.4, which works on top of libusb-1.0. It also has an alternate class that supports libusb-0.1, but you should take care to ignore this, it only serves as a place you can wander to in the documentation and get confused.
The documentation is pretty sketchy, and if you are not already very familiar with libusb C programming, this will be very hard.
There is also an older ruby gem "ruby-usb" that works only with libusb-0.1 and which you should absolutely avoid and ignore.
I was irritated that there is no method to loop through busses (like there is in native libusb). But frankly you can just use the command line "lsusb" to do most things I had in mind for this. Here is a script that does a fair imitation of lsusb:
#!/bin/ruby require 'libusb' usb = LIBUSB::Context.new dev = usb.devices dev.each { |d| puts d.inspect }
Python always drives me nuts with its brain-damaged indentation syntax, but it balances that weirdness with nice packages like this one, and a lot of people seem to like it.
SUBSYSTEM !="usb_device", ACTION !="add", GOTO="gizmo_rules_end" SYSFS{idVendor} =="03eb", SYSFS{idProduct} =="204f", SYMLINK+="gizmo" MODE="0666", OWNER="wally", GROUP="wally" LABEL="gizmo_rules_end"
Tom's Computer Info / tom@mmto.org