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
11
100%
No
0
No votes
Have no clue what I am talking about
0
No votes
Don't care
0
No votes
 
Total votes : 11

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby Diz » Tue Mar 14, 2017 3:46 am

aah ok... that makes more sense! lol :oops:
Diz
Experienced User
 
Posts: 108
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby kgschlosser » Wed Mar 15, 2017 12:31 am

please let me know if you have any issues with it. or if you would like to see something changed...
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2338
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby Diz » Wed Mar 15, 2017 4:28 am

of course... no isuues as yet :wink:
Diz
Experienced User
 
Posts: 108
Joined: Tue Jan 10, 2017 4:49 pm

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby kgschlosser » Tue Mar 21, 2017 4:14 am

I have found another glitch and have fixed it there was an undocumented GUID for network cards so I added that.

I have also found a way using WMI Query Language (WQL) to speed up the process of finding the proper device. it has given the process a HUGE speed boost. Instead of me calling WMI for all devices of a specific type and then checking each device for a matching Vendor ID I noticed that the Vendor ID was also apart of the PNPDeviceID and I learned how to use the WQL to have the SQL backend of WMI check to see if the Vendor ID is apart of the PNPDeviceID and to return devices that are. Since WMI has to iterate through all the devices any ways to select the ones i want may as well have it check for the proper ID while it's doing it. instead of having to roll through all the devices and then roll through the ones it returns looking for the device i want.

I am still testing it to make sure its good...


I am also thinking about splitting it off from the System plugin. I want to do this because I just added 2 more actions. enabling and disabling network cards. I want to expand this to blueteeth devices. and unmounting of drives. because of how many things the system plugin already does. this is going to make it overly complicated and would also cause me to have a lot of repeat code. So by moving it into it's own plugin I feel would be the right way to go.
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2338
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby kgschlosser » Thu Jun 22, 2017 7:20 pm

well people you can give this version of the system plugin a go... it is goin to require you to have EG 0.5 RC2 installed. this will not work with any versions before that
Attachments
System-1.2.0.egplugin
(150.87 KiB) Downloaded 13 times
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2338
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby Snowbird » Thu Jun 22, 2017 8:57 pm

kgschlosser wrote:well people you can give this version of the system plugin a go... it is goin to require you to have EG 0.5 RC2 installed. this will not work with any versions before that


Hi Kev,

I just tried it and got this error :

Code: Select all
22:55:20            Exception in thread WMI Thread:
22:55:20            Traceback (most recent call last):
22:55:20              File "threading.pyc", line 801, in __bootstrap_inner
22:55:20              File "C:\ProgramData\EventGhost\plugins\System\Device\Notifier.py", line 1105, in run
22:55:20                **dev
22:55:20              File "C:\ProgramData\EventGhost\plugins\System\Device\Notifier.py", line 711, in _create_event
22:55:20                if name.endswith('.'):
22:55:20            AttributeError: 'NoneType' object has no attribute 'endswith'
22:55:20           


Do I need to do something in particular ?
Snowbird
Experienced User
 
Posts: 103
Joined: Fri Jul 03, 2009 10:04 am

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby kgschlosser » Thu Jun 22, 2017 10:36 pm

ok i did not change the version number on this. but it will print out some information when that error is going to happen again. I am going to need that information that gets printed into the log. and the error will not show up or well it shouldn't it should produce an event now. and if you can copy that event that would be great

thanks
Attachments
System-1.2.0.egplugin
(150.9 KiB) Downloaded 16 times
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2338
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby Snowbird » Fri Jun 23, 2017 5:44 am

this is what I get now :

Code: Select all
07:37:58   cls_name:  PNPEntity display_name: USB Device
07:37:58   cls_name:  PNPEntity display_name: USB Device
07:37:59   cls_name:  PNPEntity display_name: Video Device
07:37:59   cls_name:  PNPEntity display_name: Video Device
07:38:00   cls_name:  PNPEntity display_name: I2C Device
07:38:00   cls_name:  PNPEntity display_name: I2C Device
07:38:01   cls_name:  PNPEntity display_name: BlueTeeth Device
07:38:01   cls_name:  PNPEntity display_name: BlueTeeth Device
07:38:01   cls_name:  PNPEntity display_name: TV Tuner
07:38:01   cls_name:  PNPEntity display_name: TV Tuner
07:38:01   cls_name:  PNPEntity display_name: HID Device
07:38:01   cls_name:  PNPEntity display_name: HID Device
07:38:01   cls_name:  PNPEntity display_name: Still Capture
07:38:01   cls_name:  PNPEntity display_name: Still Capture
07:38:02   cls_name:  PNPEntity display_name: Portable
07:38:02   cls_name:  PNPEntity display_name: Portable
07:38:02   cls_name:  PNPEntity display_name: Imaging Device
07:38:02   cls_name:  PNPEntity display_name: Imaging Device
07:38:02   cls_name:  PNPEntity display_name: EPG
07:38:02   cls_name:  PNPEntity display_name: EPG
07:38:02   cls_name:  PNPEntity display_name: Video Capture
07:38:02   cls_name:  PNPEntity display_name: Video Capture
07:38:03   cls_name:  PNPEntity display_name: Network Tuner
07:38:03   cls_name:  PNPEntity display_name: Network Tuner
07:42:11   System.Device.Attached.USBDevice.Home TV <dynamic-device 'USBDevice'>
07:42:13   System.Device.Attached.USBDevice.Home TV <dynamic-device 'USBDevice'>
07:42:14   System.Device.Attached.USBDevice.Home TV <dynamic-device 'USBDevice'>
07:42:16   System.Device.Attached.USBDevice.Home TV <dynamic-device 'USBDevice'>
07:42:18   System.Device.Attached.USBDevice.Home TV <dynamic-device 'USBDevice'>
Snowbird
Experienced User
 
Posts: 103
Joined: Fri Jul 03, 2009 10:04 am

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby Snowbird » Fri Jun 23, 2017 5:52 am

I tried to add the action "Get System Devices", and this error appeared :

Code: Select all
07:48:55   Traceback (most recent call last) (0.5.0-rc2):
07:48:55     File "C:\Program Files (x86)\EventGhost\eg\Classes\TaskletDialog.py", line 162, in ProcessingTask
07:48:55       self.Configure(*args, **kwargs)
07:48:55     File "C:\Program Files (x86)\EventGhost\eg\Classes\ConfigDialog.py", line 106, in Configure
07:48:55       treeItem.Configure(*args)
07:48:55     File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionItem.py", line 80, in Configure
07:48:55       return self.executable.Configure(*args)
07:48:55     File "C:\ProgramData\EventGhost\plugins\System\Device\Devices.py", line 218, in Configure
07:48:55       deviceItem = tree.AppendItem(deviceTree, deviceLabel)
07:48:55     File "wx\_controls.pyc", line 5456, in AppendItem
07:48:55   TypeError: String or Unicode type required


and of course the action wasn't added !
Snowbird
Experienced User
 
Posts: 103
Joined: Fri Jul 03, 2009 10:04 am

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby kgschlosser » Fri Jun 23, 2017 7:13 am

ok I am going to see if i can replicate the error on my end. but it appears as tho for some reason your devices name is being returned as None

what OS are you running?

and the Get devices is an experimental thing as well. and unless you are super familiar with python scripting it may not be of huge use to ya. I still have to key in some examples for it.
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2338
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby Snowbird » Fri Jun 23, 2017 7:24 am

I'm using Win 10 Pro version 1511 (OS Build 10586.218)
Snowbird
Experienced User
 
Posts: 103
Joined: Fri Jul 03, 2009 10:04 am

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby Snowbird » Fri Jun 23, 2017 7:34 am

I have a question, when I power on/off my living room TV I get the same event 5 times in a row is this normal ?

09:26:52 System.Device.Attached.USBDevice.Home TV <dynamic-device 'USBDevice'>
09:26:54 System.Device.Attached.USBDevice.Home TV <dynamic-device 'USBDevice'>
09:26:56 System.Device.Attached.USBDevice.Home TV <dynamic-device 'USBDevice'>
09:26:58 System.Device.Attached.USBDevice.Home TV <dynamic-device 'USBDevice'>
09:27:00 System.Device.Attached.USBDevice.Home TV <dynamic-device 'USBDevice'>

09:27:34 System.Device.Removed.USBDevice.Home TV <dynamic-device 'USBDevice'>
09:27:34 System.Device.Removed.USBDevice.Home TV <dynamic-device 'USBDevice'>
09:27:34 System.Device.Removed.USBDevice.Home TV <dynamic-device 'USBDevice'>
09:27:34 System.Device.Removed.USBDevice.Home TV <dynamic-device 'USBDevice'>
09:27:34 System.Device.Removed.USBDevice.Home TV <dynamic-device 'USBDevice'>
Snowbird
Experienced User
 
Posts: 103
Joined: Fri Jul 03, 2009 10:04 am

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby kgschlosser » Fri Jun 23, 2017 3:50 pm

hmmm... no it should not do that. but how this system works is it will only create one event for each notification that windows sends out that a device is connected. and it shouldn't be showing up as a usb device because i highly doubt your TV is plugged in via USB. the thing is that with windows 10 they rearranged a lot of things dealing with the device notifications and I am still hammering out the variations. as it appears with windows 10 the use of the device name is not used for some strange reason so i wouldn't doubt that they are populating the fields differently.

so this is what i want you to do.

I am going to need you to make a macro with the event System.Device.Attached.* and in there make a python script action and add the code below


Code: Select all
device = eg.event.payload

attribs = ['Name', 'Description', 'Caption', 'DeviceId', 'DeviceID', 'ClassGuid', 'PNPDeviceID']

data = ''
while attribs:
    attrib = attribs.pop(0)
    data += attrib + ': '
    if hasattr(device, attrib):
        data += str(getattr(device, attrib)) + ', '
    else:
        data += 'NO ATTRIBUTE, '

print data
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2338
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby Snowbird » Fri Jun 23, 2017 6:03 pm

ok, here's a sample :

Code: Select all
19:53:29   System.Device.Attached.VideoController.Intel(R) HD Graphics <dynamic-device 'VideoController'>
19:53:29      Python Script
19:53:29         Python Script
19:53:29            Name: Intel(R) HD Graphics, Description: Intel(R) HD Graphics, Caption: Intel(R) HD Graphics, DeviceId: VideoController1, DeviceID: VideoController1, ClassGuid: NO ATTRIBUTE, PNPDeviceID: PCI\VEN_8086&DEV_0046&SUBSYS_215A17AA&REV_02\3&E89B380&0&10,


Do you want me do this on a particular device ?
Snowbird
Experienced User
 
Posts: 103
Joined: Fri Jul 03, 2009 10:04 am

Re: Changes to System.DeviceAttached/System.DeviceRemoved

Postby kgschlosser » Fri Jun 23, 2017 8:35 pm

yeah the one that is coming up multiple times and the on that was throwing an error at ya before i changed the plugin.
If you like the work I have been doing then feel free to Image
User avatar
kgschlosser
Site Admin
 
Posts: 2338
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

PreviousNext

Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 3 guests