2

I have my USB keyboard (ASUS ROG Strix Scope RX) that has LED lights, connected to my laptop.

I need its LEDs to turn off when turning off my external monitor (the only one I use actually, since the lid of my laptop is closed), so I use OpenRGB to do this. The LED light goes off as expected, but then it seems that OpenRGB has full and exclusive control over the LEDs, I can't control them with Fn + arrow keys anymore. The only solution is manually unplug and then replug the keyboard.

Main Question: How can I automatically fully disconnect and then reconnect my keyboard, as if pulling its USB cable out of my laptop and then back in, using scripts or commands?

I've tried using USBDeview.exe or devcon.exe but no results.

Below there's a script I've tried creating to use devcon.exe to remove and then rescan for devices, but it doesn't work well, actually the classic Windows sound of USB device connected is played, but it doesn't appear to go far enough and isn't like actually disconnecting and reconnecting the device.


script.bat

@echo off

:: Stop HID service before disconnection powershell -Command "Stop-Service -Name 'hidserv'"

:: Remove the keyboard device (HID device) devcon remove "HID\VID_0B05&PID_1951&MI_02&COL04" timeout 2

:: Disable the USB Root Hub 3.0 to disconnect all devices connected to it devcon disable "USB\ROOT_HUB30" timeout 2

:: Enable the USB Root Hub 3.0 to reconnect the devices devcon enable "USB\ROOT_HUB30" timeout 2

:: Rescan devices to ensure proper device detection devcon rescan timeout 2

:: Restart the HID service to reset the keyboard driver powershell -Command "Start-Service -Name 'hidserv'"

:: Rescan again for any devices devcon rescan

0 Answers0