Forum: Ruby Win XP USB Port?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
89abfdb3cc8b4d9575f2b4d1d95daa26?d=identicon&s=25 E.-R. Bruecklmeier (Guest)
on 2006-02-02 00:17
(Received via mailing list)
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.
6a480fcc49315c993fc2c4f37c882133?d=identicon&s=25 Daniel Amelang (Guest)
on 2006-02-02 05:59
(Received via mailing list)
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
3203ed0e608d3bfae1e31282e629ffa2?d=identicon&s=25 Peter Fitzgibbons (Guest)
on 2006-02-02 16:06
(Received via mailing list)
On 2/1/06, E.-R. Bruecklmeier <a82374237x@radio-eriwan.de> 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"

--
89abfdb3cc8b4d9575f2b4d1d95daa26?d=identicon&s=25 E.-R. Bruecklmeier (Guest)
on 2006-02-02 16:48
(Received via mailing list)
Peter Fitzgibbons 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.
6a480fcc49315c993fc2c4f37c882133?d=identicon&s=25 Daniel Amelang (Guest)
on 2006-02-02 17:31
(Received via mailing list)
> not yet and not until the problem with the USB device is solved :-/

So how far have you got?

Dan Amelang
89abfdb3cc8b4d9575f2b4d1d95daa26?d=identicon&s=25 E.-R. Bruecklmeier (Guest)
on 2006-02-02 17:40
(Received via mailing list)
Daniel Amelang 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.
912c61d9da47754de7039f4271334a9f?d=identicon&s=25 unknown (Guest)
on 2006-02-02 18:46
(Received via mailing list)
Quoting "E.-R. Bruecklmeier" <a82374237x@radio-eriwan.de>:

> Daniel Amelang 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
6a480fcc49315c993fc2c4f37c882133?d=identicon&s=25 Daniel Amelang (Guest)
on 2006-02-02 22:36
(Received via mailing list)
Did you get my first reply that specified the functions you (likely)
have to call?

Dan Amelang
This topic is locked and can not be replied to.