4

My USB keyboard doesn't work in Xubuntu, but does in Gnome, Unity or the console. Details below...

I have a Logitech unifying USB receiver that connects to a K330 keyboard and a mouse. I have two machines both running Xubuntu 14.04. On one, they both work perfectly. On the other, the mouse works fine, and the keyboard works at the console (after pressing Ctrl-Alt-F1 to switch on the laptop keyboard), and at the lightdm login screen, but not at all once logged in to an X session.

I've run xev and it shows no keypress events coming from the USB keyboard (but it does show events from the laptop keyboard).

How can I debug and solve this problem?

Results of investigations suggested so far

lsusb outputs:

Bus 003 Device 043: ID 046d:c52b Logitech, Inc. Unifying Receiver

xinput list - when the receiver is connected, adds the following on both machines:

Logitech Unifying Device. Wireless PID:401b       id=15   [slave  pointer  (2)]
Logitech Unifying Device. Wireless PID:4016       id=16   [slave  pointer  (2)]

Note that both 401b and 4016 are listed under Virtual core pointer as pointer devices and both seem to be mouse devices when looked at with `--long``

xinput list --long on 4016 gives:

Logitech Unifying Device. Wireless PID:4016     id=13   [slave  pointer  (2)]
    This device is disabled
    Reporting 6 classes:
            Class originated from: 13. Type: XIButtonClass
            Buttons supported: 7
            Button labels: "Button 0" "Button Unknown" "Button Unknown" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right"
...

This device is disabled only appears on the computer it's not working on!

xinput list --long on 401b gives:

Logitech Unifying Device. Wireless PID:401b     id=12   [slave  pointer  (2)]
    Reporting 7 classes:
            Class originated from: 12. Type: XIButtonClass
            Buttons supported: 24
            Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" "Button Side" "Button Extra" "Button Forward" "Button Back" "Button Task" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown"
...
  • I've tested and this issue does not occur in a Unity or Gnome session, or if I just launch a terminal in the session. It only occurs in an Xfce or Xubuntu session – David Fraser May 10 '15 at 16:17
  • 2
    do you see the keyboard with lsusb – blvdeer May 18 '15 at 14:19
  • Yes I can see it with lsusb. Any other information required - let me know and I will post it – David Fraser May 18 '15 at 22:57
  • 3
    Have a look at xinput list and try xinput enable 123 where 123 is the ID of your K330 keyboard. Another (unlikely?) possibility is that an application (for battery status reporting) keeps sending control messages to the keyboard which basically prevents the keyboard from responding. – Lekensteyn May 19 '15 at 17:43
  • @Lekensteyn - thank you! xinput list --long does indeed report it as disabled, and enabling makes it work. So I can at least script a way to enable it (though when I plug it out and in it still ends up disabled). Still curious as to why, but if you post an answer (even a very simple one) then I can give you the bounty... – David Fraser May 20 '15 at 22:27
3
+100

Since xinput list shows that your keyboard has device ID 12 what you need is xinput enable 12 and now your keyboard should work. This does not help explain why Xubuntu isn't enabling it nor does it help if you unplug it and replug it. In my experience the device ID is always the same.


You can make a watchdog script to enable the keyboard if it's disabled:

  1. Run sudo mkdir -p /usr/local/bin to create the local binaries folder if doesn't exists.
  2. Run sudo touch /usr/local/bin/keyboard_watchdog to create a file on that folder.
  3. Run sudo chmod 777 /usr/local/bin/keyboard_watchdog to give it permissions to edit.
  4. Run gedit /usr/local/bin/keyboard_watchdog to edit the file.
  5. Paste in it this:

    #!/bin/bash
    
    while :; do
        xinput enable 12
        sleep 1
    done
    
  6. Save the file.
  7. Open Settings Manager and select Session and Startup.
  8. On the Application Autostart tab, click on the Add button.
  9. On the dialog that opens write the name of the application (i.e. Keyboard fix) and the command that runs the application (/usr/local/bin/keyboard_watchdog).
  10. Once you click OK the application will be added to the list and will automatically be started on the next session login.
  • I aggressively edited your answer as I think that your old answer doesn't deserve the +100 bounty. Now I included a step by step tutorial to make a watchdog to enable the keyboard. Feel free to revert. – Helio May 26 '15 at 10:51
  • nice edit - thanks... I had wanted to include a sed/awk piece that could grab the device ID in case it changed from 12 to something else - but I went on vacation for a week. – Jason May 30 '15 at 17:40
  • I've put the sed stuff in that I actually use to make this work; but I don't have it running every second, I just run it on need. Presumably it could be made to detect the plug event and run then? Any ideas? – David Fraser Jun 5 '15 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.