A pretty simple script i created for my own need to fix my keyboard.
For some reason there's this strange issue in Hyprland (or maybe Wayland, idk, i only ever noticed this on Hyprland) where some devices' permissions get messed up and you'd have to unplug them and plug them back in to get them to work.
This happened to me using this shitty keyboard of mine, the Trust Lyra Keyboard which would not work by any means if i weren't to unplug the wireless receiver and plug it back in.
I solved this simply doing a manual reset of the authorization from the kernel to the usb device and put it in a systemd unit so that it gets executed after every resume.
You can run the script in two ways, either pass the number of your device to the script, which you find running lsusb
or run it without any parameters, it'll do the same thing under the hood, but it will strip the output to be a little more readable.
Warning
In any case you'll need to install usbutils
.
If you're doing this manually, simply find your device and look for the number next to Bus xxx Device
, removing any leading 0.
📷 Click here to view an example.

In my case, the device number was 34. (Remember to remove any leading zeros)
Now curl the script and pipe it to bash:
curl -fsSL https://raw.githubusercontent.com/Xitonight/keyboardfix/main/install.sh | bash -s -- your_device_number
Note
Remember to remove -- your_device_number
if you don't know your devce number
Or, alternatively, clone the repo locally and run it:
git clone https://github.com/Xitonight/keyboardfix && cd keyboardfix
chmod +x ./install.sh
./install.sh your_device_number
Run these commands:
sudo rm -rf /etc/systemd/system/reset-usb.service
sudo systemctl daemon-reload