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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top