lib/usbutils.rb in usbutils-0.0.3 vs lib/usbutils.rb in usbutils-0.0.4
- old
+ new
@@ -18,12 +18,10 @@
Dir.glob("/sys/bus/usb/devices/usb*") do |device|
set_device(devices, device, 0, 0)
end
usb = LIBUSB::Context.new
usb.devices.each do |usbdev|
- idvendor = format("%04x", usbdev.idVendor)
- idproduct = format("%04x", usbdev.idProduct)
- device = devices.select {|item| item[:idvendor] == idvendor && item[:idproduct] == idproduct}.first
+ device = devices.select {|item| item[:serial] == usbdev.serial_number}.first
device[:usbdev] = usbdev if device
end
devices
end