Problem with Bluetooth Mouse

1 Antwort [Letzter Beitrag]
Zancudo
Offline
Beigetreten: 09/19/2012

Hallo,

I used to use a bluetooth keyboard and bluetooth mouse. As of yesterday the mouse suddenly stopped working. Both are connected:

$ hcitool con
Connections:
	< ACL 60:C5:47:18:E9:C2 handle 47 state 1 lm MASTER AUTH ENCRYPT 
	< ACL 7C:C3:A1:67:87:C3 handle 42 state 1 lm MASTER 
$ cat /sys/class/bluetooth/hci0:47/0005:05AC:0256.0005/uevent
DRIVER=apple
HID_ID=0005:000005AC:00000256
HID_NAME=zancudo’s keyboard
HID_PHYS=00:15:83:47:09:df
HID_UNIQ=60:c5:47:18:e9:c2
MODALIAS=hid:b0005g0000v000005ACp00000256
cat /sys/class/bluetooth/hci0:42/0005:05AC:030D.0004/uevent
DRIVER=magicmouse
HID_ID=0005:000005AC:0000030D
HID_NAME=
HID_PHYS=00:15:83:47:09:df
HID_UNIQ=7c:c3:a1:67:87:c3
MODALIAS=hid:b0005g0000v000005ACp0000030D

xserver refuses to use the mouse. in the log it says:

[  1078.236] (II) config/udev: Adding input device  (/dev/input/mouse0)
[  1078.236] (II) No identifier specified, ignoring this device.
[  1078.236] (II) config/udev: Adding input device  (/dev/input/event15)
[  1078.236] (**) (null): Applying InputClass "evdev pointer catchall"
[  1078.236] (**) (null): Applying InputClass "evdev pointer catchall"
[  1078.236] (II) No identifier specified, ignoring this device.

I wonder if the "No identifier specified, ignoring this device." message has to do with the empty HID_NAME which used to say "zancudo’s mouse" some days ago. Or is the problem somewhere else?

On a different machine with Parabola GNU/Linux-libre using the same usb dongle, the mouse still works fine. Thus it sould be problem with the settings in Trisquel.

How can I make xserver let me use the mouse again?

Zancudo
Offline
Beigetreten: 09/19/2012

Just for the record, it seems I got it working again. Below is what I did.

!!! Beware this might not be safe !!!

Because it seems the device name is created by the kernel, I added a small patch to the hid driver which sets a generic name whenever it would be an empty string.

This is the patch for jxself's kernel 3.12.0 (It works the same with 3.11.7, although the line numbers are slightly off. I did not try to patch Trisquel's generic kernel, which has the same problem with my mouse.):

diff -ruN linux-source-3.12.0-gnu.orig/drivers/hid/hid-core.c linux-source-3.12.0-gnu/drivers/hid/hid-core.c
--- linux-source-3.12.0-gnu.orig/drivers/hid/hid-core.c 2013-11-04 00:41:51.000000000 +0100
+++ linux-source-3.12.0-gnu/drivers/hid/hid-core.c      2013-11-16 14:14:14.936673567 +0100
@@ -1490,6 +1490,8 @@

 int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
 {
+       if(strlen(hdev->name)==0)
+               sprintf(hdev->name, "empty");
        static const char *types[] = { "Device", "Pointer", "Mouse", "Device",
                "Joystick", "Gamepad", "Keyboard", "Keypad",
                "Multi-Axis Controller"

What is possibly unsafe: I am not sure, if the memory for storing the name must be allocated and how that would be done. However, until now it didn't do any (noticable) bad.

Compiling the kernel

Download the sources and copy, extract at some other place

# apt-get install linux-source-3.12.0-gnu
cp /usr/src/linux-source-3.12.0-gnu.tar.bz2 some/place
cd some/place
tar -xjf linux-source-3.12.0-gnu.tar.bz2

Patch it

cd some/place/linux-source-3.12.0-gnu
patch -p1 -i path/to/patch

Copy original kernel config and build it

cat /boot/config-3.12.0-gnu >.config
make oldconfig
make-kpkg clean
fakeroot make-kpkg -j1 --initrd kernel_image

Install it

# dpkg -i some/place/linux-image-3.12.0-gnu_3.12.0-gnu-10.00.Custom_amd64.deb

Funny

On the same machine booting Parabola which to my understanding uses the same kernel sources as Trisquel and jxself do, the kernel names the mouse "Apple Magic Mouse". Well, this seems to say: there should be a smarter way of setting the mouse name, than ugly patching the kernel. I am not sure, if it is the kernel config file, or some other software involved (maybe systemd vs upstart)?