Ruby-USB in windows

S

Srinivasan R.

Hi.

I am trying to talk to a USB device (a thumb drive) in Windows 7 via
Ruby. I installed the Ruby-USB gem without errors. I tried a simple code
snippet wherein I tried to list all the USB devices connected on the
system -

require 'usb'
USB.devices


However, in IRB, this is just outputting []. I tried to use
USB.find_devices and that is outputting 0.

What exactly am I doing wrong? Do I need to give admin rights to Ruby
under Win 7 to detect USB devices. If yes, can someone enlighten me how
to do it?

If this is a report, kindly excuse.

Thanks
 
L

Luis Lavena

Hi.

I am trying to talk to a USB device (a thumb drive) in Windows 7 via
Ruby. I installed the Ruby-USB gem without errors. I tried a simple code
snippet wherein I tried to list all the USB devices connected on the
system -

require 'usb'
USB.devices

However, in IRB, this is just outputting []. I tried to use
USB.find_devices and that is outputting 0.

Did you install libusb? libusb is a driver require by ruby-usb to
communicate on Windows to the USB layer.

http://www.libusb.org/

I have no experience with this, so beyond these two comments, cannot
give you more help
What exactly am I doing wrong? Do I need to give admin rights to Ruby
under Win 7 to detect USB devices. If yes, can someone enlighten me how
to do it?

You will need to start a command prompt elevated (admin rights) look
on Google for "elevate.vbs" which is a command line script that mimics
sudo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top