Win XP USB Port?


#1

Good morning rubyists,

has anyone ever tried to termiante a USB device on a Win XP system from
ruby?

best regard out of the ice

eric.


#2

How’s the weather down there?

I haven’t tried, but it may be possible using the following technique.
Let me know if you need more help doing any of the steps:

  1. Using ruby dl, connect to setupapi.dll and kernel32.dll
  2. Call the function CM_Locate_DevNode to get the device handle for
    the usb drive.
  3. Call the function CM_Request_Device_Eject to stop the usb device.

You’ll need to do a google search of microsoft.com for each of those
functions to know how to call them.

Dan


#3

On 2/1/06, E.-R. Bruecklmeier removed_email_address@domain.invalid wrote:

Dr. Eric-Roger Bruecklmeier
Electronics Engineer / Communications Officer
Neumayer Station Antarctica
70°39’S 08°15’W

I’m officially using you as a reference in my next “Ruby/Rails is
Viable”
defense :

“They use in research on Antartica”


#4

Peter F. schrieb:

I’m officially using you as a reference in my next “Ruby/Rails is Viable”
defense :

“They use in research on Antartica”

not yet and not until the problem with the USB device is solved :-/

eric.


#5

not yet and not until the problem with the USB device is solved :-/

So how far have you got?

Dan Amelang


#6

Quoting “E.-R. Bruecklmeier” removed_email_address@domain.invalid:

Daniel A. schrieb:

not yet and not until the problem with the USB device is solved
:-/
So how far have you got?

I’m still looking for a posibillity to switch of a USB device out
of ruby.

That isn’t really a Ruby question so much as an “is there a
library/API to do this and can I use it from Ruby?” question. (If
the first answer is yes, the second answer is a qualified yes,
though you might need to write a C extension.)

What specific USB device are we talking about, and what do you mean
by “switch off”? Is this something you already know how to do from
another language?

-mental


#7

Daniel A. schrieb:

not yet and not until the problem with the USB device is solved :-/

So how far have you got?

I’m still looking for a posibillity to switch of a USB device out of
ruby.

eric.


#8

Did you get my first reply that specified the functions you (likely)
have to call?

Dan Amelang