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.

Changes to System.DeviceAttached/System.DeviceRemoved

Got a good idea? You can suggest new features here.

Add device names and other device data to System.DeviceAttached/System.DeviceRemoved

Yes
14
100%
No
0
No votes
Have no clue what I am talking about
0
No votes
Don't care
0
No votes
 
Total votes: 14

User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser »

Diz wrote:well ok then but it seems to me totally pointless to show a human that a string is unicode but if its out of your control fair enough! :) lol
you would understand the purpose better if you dove into python a bit more.


well.. here goes.. I have attached an updated version of the DeviceChangeNotifier the drives are working... tho not as i want. I am going to have to do some more research to figure out a way to grab the device the volume is attached to.
If you like the work I have been doing then feel free to Image
Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz »

i do know the purpose, i understand unicode, but to me as a human the 'u' is irrelevent, either it will be in my own language or it wont! i just think as humans we dont need to see the 'u'... surely only the program needs to know they are there. but hey, just an opinion, i dont wanna go on about it anymore :)
Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz »

new version still completely ignores my phones and memory stick. here is what the old plugin shows for my windows phone just in case it will help ;)

19:39:15 System.DeviceAttached [u'\\\\?\\USB#Vid_045e&Pid_04ec#99461300-b56a-0801-73a7-cfba533bb5dd#{a5dcbf10-6530-11d2-901f-00c04fb951ed}']
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser »

wow i do not understand as to why it's not seeing them. There is one possibility. and it could have to do with how the vendor ID is laid out. But it could also be that it's because you are running on a Windows XP box. If you have access to a Windows 7 or newer machine and could try it there it would be most helpful. And the last thing is GUID's the way to check the GUID's is if you go into device manager and bring up the properties for that device. go to the details tab. In the property dropdown you should have an option for "Device class guid" this will list the GUID for the device class your phone or memory card is in.. I can then check it against what I am using and add it. I have been searching for a Windows XP API but haven't come up with anything. Windows XP didn't have the best identification system in place.. They started doing this in Windows Vista and newer. Just like the RegisterPowerBroadcastNotifier that doesn't exist in windows XP



**EDIT** scratch that as far as checking the guid. it is attached at the end of the old version and it is set in my version as well.. so it has to do with the vendor Id (hardware Id) if you could go to that same dropdown and grab the ID's from Hardware ID's so I know exactly how they should be formatted so I can do up the conversion.

and the example you are showing is that for the phone? and have you also tested the memory stick in the old version as well?? because i am using the exact same mechanics as the old plugin for getting the drive mounting and unmounting so that not working is a complete mystery if it works fine in the old version of EG.
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser »

and also that vendor ID and device ID that are in the data from the old version is for a Microsoft Zune which if memory serves is an MP3 player.. not a phone or a flash drive. I just want to make sure the same device are being used to test between the 2 different versions.
If you like the work I have been doing then feel free to Image
Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz »

yes i tested two phones and a memory stick, all totally ignored by new plugin! i dont have access to windows 7. here is the output from the old plugin followed by the hardware id's from device manager for all three devices:

phone 1:
19:39:15 System.DeviceAttached [u'\\\\?\\USB#Vid_045e&Pid_04ec#99461300-b56a-0801-73a7-cfba533bb5dd#{a5dcbf10-6530-11d2-901f-00c04fb951ed}']
USB\Vid_045e&Pid_04ec&Rev_0000&MI_01
USB\Vid_045e&Pid_04ec&MI_01

phone 2:
05:00:59 System.DeviceRemoved [u'\\\\?\\USB#Vid_04e8&Pid_6860#479007563d6f5004#{a5dcbf10-6530-11d2-901f-00c04fb951ed}']
USB\Vid_04e8&Pid_6860&Rev_0400
USB\Vid_04e8&Pid_6860

memory stick:
05:06:19 System.DeviceAttached [u'\\\\?\\USB#Vid_090c&Pid_1000#AA04012700013971#{a5dcbf10-6530-11d2-901f-00c04fb951ed}']
05:06:19 System.DeviceAttached [u'\\\\?\\USBSTOR#Disk&Ven_USB&Prod_DISK_Pro&Rev_1100#AA04012700013971&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}']
STORAGE\Volume
Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz »

it is a nokia windows phone and you are supposed to use the hideous microsoft zune software to transfer data to it 'the proper way'!
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser »

ok cool. just wanted to make sure. because I have had some people do that. i just want to make sure we are keeping everything the same...

I am rewriting most of the Device Notifier. I have discovered there is a single RegisterDeviceNotification metric i can send that actually covers all devices. and I also learned how to parse the device group GUID from the notification it's self. this will speed up response time greatly. i also found the error in the vendor ID's it's funny because windows will send the vendorID in the notification all lowercase but sometimes it is set in the driver as uppercase. kinda odd it does that. I am just trying to hammer out a couple of glitches in it. I am also going to create a thread for running WMI from instead of the main thread this is due to how expensive WMI is to run and it causes a momentary hang in the gui for EG because the mainthread is where the gui runs. and this i do not like.
If you like the work I have been doing then feel free to Image
Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz »

ok great, lookin forward to testing to the next version! :wink:
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser »

I am so F*#$(&^ frustrated with it.. I moved the whole thing to a thread based setup.. and it works.. and it works very well i might add. no more pause in the GUI on startup.

except... now here is the really goofy part which i cannot seem to figure out. it gets all the data. it assembles it all into suffix and payload.. if i use print to print the suffix and payload everything is peachy right after the print statement. i will call eg.TriggerEvent(suffix, payload) and nothing... no event... WTF!!!! I have been running through my code from the start of the process to the end of the process. following the notifications, vendorID's, guid's step by step through the code. all the way to the very end.. right where the trigger event is.. and everything is great. but no event. I have spent 2 hours doing that to lead to a complete f'in mystery. other events get triggered. from other plugins.

HA! don't know why this is but not all events are getting triggered. i just noticed when i copy something i don't get a system.clipboardchanged event. and the mystery continues
If you like the work I have been doing then feel free to Image
Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz »

oh ok... that reminds me: the clipboardchanged event only works if you copy from something other than eg but after looking at the code this seems to be by design. i just kinda wondered why is all. lol
User avatar
kgschlosser
Site Admin
Posts: 5190
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by kgschlosser »

Diz wrote:oh ok... that reminds me: the clipboardchanged event only works if you copy from something other than eg but after looking at the code this seems to be by design. i just kinda wondered why is all. lol

to be honest I'm not sure...


and you wouldn't believe what my problem was... I actually removed every ounce of EG and python from my computer spent hours trying to figure out what the problem was... you know that stupid little check box at the bottom of the EG window... i must have accidentally checked it. and i use the same config file for all version of EG so that's why it was happening to every single copy i had on my machine. what a waste. I used to do the same thing when the auto scroll check box was there... I would really like to move that dumb thing into the view menu. it's to easy to click on and not know ya did it. and then get no events and wonder why.

attached is yet another version of the plugin.

Now i do want to throw this out there... this is going to kick out an event for every single driver type a specific device driver has been registered to.. for instance... I am getting a TV Tuner device class for my phone as well as a CD ROM class. it's how the manufacturer made the driver.. why they added it some of the device classes i have no clue but they did.
If you like the work I have been doing then feel free to Image
Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz »

hmmm... bad news :( this version wont run at all for me. this is the output upon starting eg (i restarted a few times to be sure and always same):

04:04:53 Exception in thread WMI Thread:
04:04:53 Traceback (most recent call last):
04:04:53 File "threading.pyc", line 801, in __bootstrap_inner
04:04:53 File "D:\EventGhost\plugins\System\DeviceChangeNotifier.py", line 781, in run
04:04:53 for attrName in dev['attr_names']
04:04:53 File "D:\EventGhost\plugins\System\DeviceChangeNotifier.py", line 781, in <dictcomp>
04:04:53 for attrName in dev['attr_names']
04:04:53 File "win32com\client\dynamic.pyc", line 527, in __getattr__
04:04:53 AttributeError: <unknown>.FirmwareRevision
04:04:53

im glad you fixed your problem though :)
Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz »

oh, wait... good news too :) looking at the errors its pretty clear what is the problem so just for testing purposes i commented out all the 'FirmwareRevision' lines in the 'attr_names' sections (LOL... i really didnt expect this to work!) and then it worked! new plugin output:

04:26:10 System.DeviceAttached.TVTuner.Lumia 610 {'device': <COMObject <unknown>>, 'status': u'OK', 'description': u'Windows Phone 7', 'name': u'Lumia 610', 'device_id': u'USB\\VID_045E&PID_04EC&MI_00\\6&37A8D9E9&0&0000'}
04:26:10 System.DeviceAttached.TVTuner.Lumia 610 {'device': <COMObject <unknown>>, 'status': u'OK', 'description': u'Windows Phone 7', 'name': u'Lumia 610', 'device_id': u'USB\\VID_045E&PID_04EC&MI_00\\6&37A8D9E9&0&0000'}
04:26:10 System.DeviceAttached.ImageCapture.Lumia 610 {'device': <COMObject <unknown>>, 'status': u'OK', 'description': u'Windows Phone 7', 'name': u'Lumia 610', 'device_id': u'USB\\VID_045E&PID_04EC&MI_00\\6&37A8D9E9&0&0000'}
04:26:10 System.DeviceAttached.TVTuner.Windows Phone USB {'device': <COMObject <unknown>>, 'status': u'OK', 'description': u'Windows Phone USB', 'name': u'Windows Phone USB', 'device_id': u'USB\\VID_045E&PID_04EC&MI_01\\6&37A8D9E9&0&0001'}

so... i guess maybe the 'FirmwareRevision' attribute doesnt exist on xp or something?
Diz
Experienced User
Posts: 121
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Post by Diz »

ok... scratch that last question! after a little more playing it turns out that i actually only need to comment out one 'FirmwareRevision' line in the 'attr_names' section of the 'DiskDrive' device to make it work
Post Reply