Ubuntu – Logitech k350 keyboard and m510 mouse not working unless I unplug and replug dongle 20 times

12.04keyboardlogitechlogitech-unifyingmouse

I just installed the Logitech k350 keyboard and m510 mouse not working unless I unplug and replug dongle up to 20 times. (This is on Ubuntu 12.04, I tried this replacing an existing keyboard and mouse and also reinstalling the OS)

I found a number of posts similar to this but the scenario was a little different, and the solution did not help.

The best I got was run this in a start up script:

rmmod hid_logitech_dj
modprobe hid_logitech_dj

I tried that (as well as modprobe -r hid_logitech_dj) and still have to unplug and plug the dongle several times. I also try variations of that, such as a for loop that runs that 10, 20 and 50 times, I even set it to sleep for a couple seconds after each command.

When running that script manually with the for loop I find it randomly either works or doesn't work. IE. I can run it 10 times and 5 times I will have keyboard and mouse, and 5 times I will have to unplug and replug the dongle (once or twice).

The other thing I tried was, #1 the startup script, and #2 also a cronjob that would run every minute to run those commands, after 10 minutes, I didn't have keyboard or mouse. However when I rebooted and left the computer on over night, I had keyboard and mouse in the morning.

Does anyone know a reliable solution for this? The best I have found is the startup script, the crontab, but even after about a 10 minutes I still have unplug and replug the dongle, which isn't a great solution, when you got an SSD harddrive for lightning fast boot times.

TIA

Best Answer

This issue seems often to occur on USB 3.0 ports, so try a USB 2.0 before continuing.

If switching ports does not work, you can try my suggestions on Arch Linux forums, you can try to force a re-enumeration of Unified devices. This can be done by writing a special request to the receiver:

# should output /dev/hidrawN where N is usually 0
hidraw=/dev/$(cd /sys/bus/hid/drivers/logitech-djreceiver/*/hidraw && echo hidraw*)
printf '\x20\xff\x81\0\0\0\0\0\0\0\0\0\0\0\0' | sudo tee "$hidraw" >/dev/null

It has been confirmed to work. You only need to perform this action once in a boot, so a startup script should be fine.