Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Costumize USB Device Attached Event

If you have a question or need help, this is the place to be.
Post Reply
bert0r
Posts: 5
Joined: Thu Nov 04, 2010 8:08 am

Costumize USB Device Attached Event

Post by bert0r »

Hi

when I attach an USB-Device to the PC than the System.DeviceAttached Event is show in the log:

System.DeviceAttached [u'\\\\?\\USB#Vid_03eb&Pid_6124#5&33a95ce&0&8#{a5dcbf10-6530-11d2-901f-00c04fb951ed}']

is there a way to react on a that special USB device (depending on IDs) ? I mean is there a opportunity to add the device VID und PID to the event System.DeviceAttached as it is shown in the log?

thank you


Im using EventGhost 0.3.7.r1462 on Windows XP SP3
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Costumize USB Device Attached Event

Post by Pako »

I'm not sure if I understand correctly your question. Maybe because the solution is trivial:
EventConvertor.jpg
EventConvertor.jpg (13.26 KiB) Viewed 6436 times
Use Python Command action.
Pako
bert0r
Posts: 5
Joined: Thu Nov 04, 2010 8:08 am

Re: Costumize USB Device Attached Event

Post by bert0r »

thank you so far...

im new to EventGhost and also to Phyton ;)

i actually want to run an application when an USB device is plugged in... so my question is if there is a way to run an application when one special USB Device is connected... e.g. if i plug in a mouse, eventghost wont launch the application, but if i plug in a device with e.g. vendor id xyxy & product id yxyx eventghost will launch the application... ;)

At the moment the application starts but it does it for any USB device...


ty
User avatar
jinxdone
Plugin Developer
Posts: 443
Joined: Tue Jan 02, 2007 4:08 pm

Re: Costumize USB Device Attached Event

Post by jinxdone »

Did you actually try the example that Pako posted? It should allow you to do exactly what you are asking for.

Maybe something like this would be better to pick out only vid and pid value from the string though. (so you dont have to plug the device into the same usb port every time).

Code: Select all

eg.TriggerEvent(eg.event.payload[0][8:25], prefix = eg.event.suffix)
bert0r
Posts: 5
Joined: Thu Nov 04, 2010 8:08 am

Re: Costumize USB Device Attached Event

Post by bert0r »

hey there,

i just tried it and hmm actually its very easy ;) ... but im far away from understanding the commands...

you did a great job with eventghost...thank you all very much!

greetz
nico
bert0r
Posts: 5
Joined: Thu Nov 04, 2010 8:08 am

Re: Costumize USB Device Attached Event

Post by bert0r »

hey its me again :)

it now works that eventghost triggers only the specific usb device... but if i plug it into a different USB-Slot it doesnt work anymore..

atm the event looks like this:

DeviceAttached.\\?\USB#Vid_03eb&Pid_6124#5&33a95ce&0&8#{a5dcbf10-6530-11d2-901f-00c04fb951ed}

it seems that the numbers between #5&33a95ce&0&8# correspond to the usb port... is it possible to insert a wildcard or something like that ?

thanks again :)
User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Costumize USB Device Attached Event

Post by Pako »

This problem has already resolved the improvements proposed by jinxdone:

Code: Select all

eg.TriggerEvent(eg.event.payload[0][8:25], prefix = eg.event.suffix)
Pako
bert0r
Posts: 5
Joined: Thu Nov 04, 2010 8:08 am

Re: Costumize USB Device Attached Event

Post by bert0r »

oh didnt see it... but great anyway...

thank you again...
Post Reply