Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate System.DeviceAttached/DeviceRemoved events for USB hubs #395

Open
maffe opened this issue Apr 24, 2020 · 1 comment
Open

Generate System.DeviceAttached/DeviceRemoved events for USB hubs #395

maffe opened this issue Apr 24, 2020 · 1 comment

Comments

@maffe
Copy link

maffe commented Apr 24, 2020

Is your feature request related to a problem? Please describe.
I use a USB switch to connect my input devices to multiple computers. It’s a 4-port USB hub which connects the devices plugged into it to different computers which can be selected by pressing a button. System.DeviceAttached and System.DeviceRemoved events are generated for the devices connected to this switch, but not for the switch/hub itself.

Describe the solution you'd like
System.DeviceAttached and System.DeviceRemoved events should be generated when connecting/disconnecting a USB hub. The switch/hub I use has the hardware ID USB\VID_1A40&PID_0101&REV_0111.

Describe alternatives you've considered
Currently I let EventGhost react on the PIDs/VIDs of the devices connected to the hub.

Additional context
I use this Python script triggered by System.DeviceAttached and System.DeviceRemoved to generate events unique to each connected device:

if eg.event.payload[0].startswith(u'\\\\?\\USB#'):
    eg.TriggerEvent(u'USB.' + eg.event.payload[0][4:].split(u'#')[1].upper(), prefix = eg.event.suffix)

if eg.event.payload[0].startswith(u'\\\\?\\HID#'):
    eg.TriggerEvent(u'HID.' + eg.event.payload[0][4:].split(u'#')[1].upper(), prefix = eg.event.suffix)

When an input device is connected, EventGhost runs ControlMyMonitor which sets the monitor input (via DDC) to the computer the input device is connected to.

@kdschlosser
Copy link
Member

I have been working on a viable solution for this for some time. If you look on the EventGhost forums there is a newer test version of the System plugin that should produce the events for the USB hub. I am the person that write the plugin and it does work for generating events for system level devices like USB hubs. The reason why the plugin has not been added into EventGhost is because I do not personally care for using WMI in order to collect the data, which is how i coded that plugin to work. WMI is to slow a mechanism for my liking and it has a very odd API to it that changed based on type of device. It has to many variations to account for all of them easily. One example would be it's handling of Bluetooth and Bluetooth devices.

For your needs it should do the job.

If you read this forum topic you will find the updated system plugin attached to one of the posts. be sure to comb over the whole thread and don't install the first one you come across later versions are probably going to be later in the forum topic
http://www.eventghost.net/forum/viewtopic.php?f=5&t=9588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants