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.
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
Re: Changes to System.DeviceAttached/System.DeviceRemoved
aah ok... that makes more sense! lol 
- 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
please let me know if you have any issues with it. or if you would like to see something changed...
Re: Changes to System.DeviceAttached/System.DeviceRemoved
of course... no isuues as yet 
- 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
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.
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.
- 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
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 122 times
Re: Changes to System.DeviceAttached/System.DeviceRemoved
Hi Kev,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
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 - 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
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
thanks
- Attachments
-
- System-1.2.0.egplugin
- (150.9 KiB) Downloaded 150 times
Re: Changes to System.DeviceAttached/System.DeviceRemoved
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'>Re: Changes to System.DeviceAttached/System.DeviceRemoved
I tried to add the action "Get System Devices", and this error appeared :
and of course the action wasn't added !
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- 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
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.
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.
Re: Changes to System.DeviceAttached/System.DeviceRemoved
I'm using Win 10 Pro version 1511 (OS Build 10586.218)
Re: Changes to System.DeviceAttached/System.DeviceRemoved
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'>
- 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
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
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
Re: Changes to System.DeviceAttached/System.DeviceRemoved
ok, here's a sample :
Do you want me do this on a particular device ?
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, - 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
yeah the one that is coming up multiple times and the on that was throwing an error at ya before i changed the plugin.
