Re: [bug?] [powerpc] hid_logitech_dj: Wireless mouse does not work in xorg or gpm

12 messages, 4 authors, 2012-05-11 · open the first message on its own page

Re: [bug?] [powerpc] hid_logitech_dj: Wireless mouse does not work in xorg or gpm

From: Hugo Osvaldo Barrera <hidden>
Date: 2012-05-06 03:14:32

Hi,

I apologize for not replying to the last e-mail and replying to an older one instead, I seem to have lost the last couple. :(

Before I begin, let me say I downloaded the kernel sources only a few hours after your previous message, but the patch did not apply (I'm not sure why; I got a "corrupt patch" error).
I applied the changes manually.

Here's the dmesg I got:

[69237.004750] usbcore: deregistering interface driver usbhid
[69243.219600] hid: hid_debug is now used solely for parser and driver debugging.
[69243.219608] debugfs is now used for inspecting the device (report descriptor, reports)
[69350.013383] hid: hid_debug is now used solely for parser and driver debugging.
[69350.013390] debugfs is now used for inspecting the device (report descriptor, reports)
[69358.971680] usbcore: registered new interface driver usbhid
[69358.971692] usbhid: USB HID core driver
<Mouse receiver was plugged in at this point.  Mouse was off.>
[69358.973309] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: Logitech-DJ:logi_dj_init
[69381.670037] usb 4-1: new full-speed USB device number 5 using ohci_hcd
[69381.892043] usb 4-1: New USB device found, idVendor=046d, idProduct=c52b
[69381.892054] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[69381.892060] usb 4-1: Product: USB Receiver
[69381.892065] usb 4-1: Manufacturer: Logitech
[69381.898155] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 0
[69381.898311] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_probe called for ifnum 0
[69381.898321] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_probe: ignoring ifnum 0
[69381.898440] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 1
[69381.898537] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_probe called for ifnum 1
[69381.898546] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_probe: ignoring ifnum 1
[69381.898651] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 2
[69381.898750] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_probe called for ifnum 2
[69381.904988] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x1001 wIndex=0x0200 wLength=1792
[69381.907044] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x1101 wIndex=0x0200 wLength=5120
[69381.908029] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x2001 wIndex=0x0200 wLength=3840
[69381.909028] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x2101 wIndex=0x0200 wLength=8192
[69381.911438] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0001:10:1b.1-1/input2
[69381.918070] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69381.918124] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: delayedwork_callback
[69381.918135] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_recv_add_djhid_device: device list is empty
[69381.920069] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69381.920119] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: delayedwork_callback
[69381.920297] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_ll_parse
[69381.920308] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_ll_start
<Mouse was turned on at this point.>
[69381.920430] logitech-djdevice 0003:046D:C52B.0004: hidraw1: USB HID v1.11 Device [Logitech Unifying Device. Wireless PID:101a] on usb-0001:10:1b.1-1:1
[69395.230032] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69395.782013] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69395.782030] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-core.c: undefined report_id 0 received
[69395.782039] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: hid_input_report error
[69395.806001] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69395.806016] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-core.c: undefined report_id 0 received
[69395.806025] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: hid_input_report error
[69395.813994] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69395.814009] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-core.c: undefined report_id 0 received
[69395.814017] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: hid_input_report error
[69395.821990] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69395.822004] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-core.c: undefined report_id 0 received
[69395.822012] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: hid_input_report error
[69395.829989] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69395.830003] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-core.c: undefined report_id 0 received
[69395.830012] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: hid_input_report error
[69395.837988] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69395.838002] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-core.c: undefined report_id 0 received
[69395.838011] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: hid_input_report error
[69395.845989] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69395.846003] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-core.c: undefined report_id 0 received
[69395.846011] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: hid_input_report error
[69395.853990] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69395.854004] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-core.c: undefined report_id 0 received
[69395.854013] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: hid_input_report error
[69395.861992] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69395.862006] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-core.c: undefined report_id 0 received
[69395.862014] /build/buildd-linux-2.6_3.3.4-1~experimental.1-powerpc-atUZTv/linux-2.6-3.3.4/debian/build/source_powerpc_none/drivers/hid/hid-logitech-dj.c: hid_input_report error


Here's the capture of the pairing event.
I found four devices in /sys/kernel/debug/hid/, so I tried each one until I found one that produced output upon pairing the mouse.

# mount -t debugfs debugfs /sys/kernel/debug
# ls /sys/kernel/debug/hid/
0003:046D:C52B.0001  0003:046D:C52B.0002  0003:046D:C52B.0003  0003:046D:C52B.0004
# modprobe -r hid_logitech_dj
# modprobe hid_logitech_dj
# cat /sys/kernel/debug/hid/0003\:046D\:C52B.0003/events > events.captured03

I tried all four, because I wasn't sure which one I should cat (/sys/kernel/debug/hid/0003\:046D\:C52B.000{1,2,3,4}/events).
The devices ending in 1,2 and 4 didn't show any output anything.
Reading from 0003:046D:C52B.0003 resulted in the following

<Mouse turned on at this point>
report (size 15) (numbered) =  20 01 42 00 00 00 00 00 00 00 00 00 00 00 00
<Mouse turned off at this point>
report (size 15) (numbered) =  20 01 42 01 00 00 00 00 00 00 00 00 00 00 00
<EOF>

The devices ending in 0003 and 0004 both showed plenty of output when moving the mouse around.

Just in case there any doubt; this was all on the powerpc machine.
Do you need me to rebuild the kernel with that patch and retry on amd64 as well?

Thanks,

Hugo

Re: [bug?] [powerpc] hid_logitech_dj: Wireless mouse does not work in xorg or gpm

From: Jonathan Nieder <hidden>
Date: 2012-05-06 05:55:24

Hugo Osvaldo Barrera wrote:
Here's the dmesg I got:
Thanks.

[...]
[69358.971692] usbhid: USB HID core driver
<Mouse receiver was plugged in at this point.  Mouse was off.>
[69358.973309] [...]/drivers/hid/hid-logitech-dj.c: Logitech-DJ:logi_dj_init
[...]
[69381.911438] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0001:10:1b.1-1/input2
[69381.918070] [...]/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69381.918124] [...]/drivers/hid/hid-logitech-dj.c: delayedwork_callback
[69381.918135] [...]/drivers/hid/hid-logitech-dj.c: logi_dj_recv_add_djhid_device: device list is empty
[69381.920069] [...]/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69381.920119] [...]/drivers/hid/hid-logitech-dj.c: delayedwork_callback
[69381.920297] [...]/drivers/hid/hid-logitech-dj.c: logi_dj_ll_parse
[69381.920308] [...]/drivers/hid/hid-logitech-dj.c: logi_dj_ll_start
<Mouse was turned on at this point.>
[69381.920430] logitech-djdevice 0003:046D:C52B.0004: hidraw1: USB HID v1.11 Device [Logitech Unifying Device. Wireless PID:101a] on usb-0001:10:1b.1-1:1
Still no "logi_dj_ll_parse: sending a mouse descriptor, reports_supported: 4"
so it looks like the patch didn't have the intended effect.  Alas.

The pairing (...add_djhid_device) happens during initialization,
before the mouse is turned on...
Here's the capture of the pairing event.
[...]
Reading from 0003:046D:C52B.0003 resulted in the following

<Mouse turned on at this point>
report (size 15) (numbered) =  20 01 42 00 00 00 00 00 00 00 00 00 00 00 00
<Mouse turned off at this point>
report (size 15) (numbered) =  20 01 42 01 00 00 00 00 00 00 00 00 00 00 00
<EOF>
... so the events captured do not include pairing events (0x41).  What
we see here are connection status events (0x42).  Sorry about that.

Here's a new patch that prints more information to dmesg.  After
applying the patch, you can use the patched driver by running

	make drivers/hid/hid-logitech-dj.ko
	modprobe -r hid-logitech-dj
	insmod drivers/hid/hid-logitech-dj.ko
---
Thanks again,
Jonathan

 drivers/hid/hid-logitech-dj.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index e1c38bba4375..33a70cfbec77 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -23,6 +23,7 @@
 
 
 #include <linux/device.h>
+#include <asm/unaligned.h>
 #include <linux/hid.h>
 #include <linux/module.h>
 #include <linux/usb.h>
@@ -273,8 +274,8 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
 		goto dj_device_allocate_fail;
 	}
 
-	dj_dev->reports_supported = le32_to_cpu(
-		dj_report->report_params[DEVICE_PAIRED_RF_REPORT_TYPE]);
+	dj_dev->reports_supported = get_unaligned_le32(
+		dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE);
 	dj_dev->hdev = dj_hiddev;
 	dj_dev->dj_receiver_dev = djrcv_dev;
 	dj_dev->device_index = dj_report->device_index;
@@ -618,9 +619,18 @@ static int logi_dj_raw_event(struct hid_device *hdev,
 	struct dj_report *dj_report = (struct dj_report *) data;
 	unsigned long flags;
 	bool report_processed = false;
+	char buf[32 * 3 + 1];
+	int i;
 
 	dbg_hid("%s, size:%d\n", __func__, size);
 
+	if (0 < size && size <= 32) {
+		for (i = 0; i < size; i++)
+			snprintf(buf + 3*i, sizeof(buf) - 3*i,
+					" %02x", data[i]);
+		dbg_hid("%s: report = %s\n", __func__, buf);
+	}
+
 	/* Here we receive all data coming from iface 2, there are 4 cases:
 	 *
 	 * 1) Data should continue its normal processing i.e. data does not
-- 
1.7.10.1

Re: [bug?] [powerpc] hid_logitech_dj: Wireless mouse does not work in xorg or gpm

From: Hugo Osvaldo Barrera <hidden>
Date: 2012-05-06 06:10:05

Hi Jonathan,

On 2012-05-06 02:55, Jonathan Nieder wrote:
Hugo Osvaldo Barrera wrote:
quoted
Here's the dmesg I got:
Thanks.

[...]
quoted
[69358.971692] usbhid: USB HID core driver
<Mouse receiver was plugged in at this point.  Mouse was off.>
[69358.973309] [...]/drivers/hid/hid-logitech-dj.c: Logitech-DJ:logi_dj_init
[...]
quoted
[69381.911438] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0001:10:1b.1-1/input2
[69381.918070] [...]/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69381.918124] [...]/drivers/hid/hid-logitech-dj.c: delayedwork_callback
[69381.918135] [...]/drivers/hid/hid-logitech-dj.c: logi_dj_recv_add_djhid_device: device list is empty
[69381.920069] [...]/drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[69381.920119] [...]/drivers/hid/hid-logitech-dj.c: delayedwork_callback
[69381.920297] [...]/drivers/hid/hid-logitech-dj.c: logi_dj_ll_parse
[69381.920308] [...]/drivers/hid/hid-logitech-dj.c: logi_dj_ll_start
<Mouse was turned on at this point.>
[69381.920430] logitech-djdevice 0003:046D:C52B.0004: hidraw1: USB HID v1.11 Device [Logitech Unifying Device. Wireless PID:101a] on usb-0001:10:1b.1-1:1
Still no "logi_dj_ll_parse: sending a mouse descriptor, reports_supported: 4"
so it looks like the patch didn't have the intended effect.  Alas.

The pairing (...add_djhid_device) happens during initialization,
before the mouse is turned on...
I don't think I quite follow there.  By "pairing" I though you meant
when the receiver connects to the mouse.  How can the pairing be done
while the device is off?  Or what am I missing here?
quoted
Here's the capture of the pairing event.
[...]
quoted
Reading from 0003:046D:C52B.0003 resulted in the following

<Mouse turned on at this point>
report (size 15) (numbered) =  20 01 42 00 00 00 00 00 00 00 00 00 00 00 00
<Mouse turned off at this point>
report (size 15) (numbered) =  20 01 42 01 00 00 00 00 00 00 00 00 00 00 00
<EOF>
... so the events captured do not include pairing events (0x41).  What
we see here are connection status events (0x42).  Sorry about that.

Here's a new patch that prints more information to dmesg.  After
applying the patch, you can use the patched driver by running

	make drivers/hid/hid-logitech-dj.ko
	modprobe -r hid-logitech-dj
	insmod drivers/hid/hid-logitech-dj.ko
Great, that'll save me plenty of time!
quoted hunk
---
Thanks again,
Jonathan

 drivers/hid/hid-logitech-dj.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index e1c38bba4375..33a70cfbec77 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -23,6 +23,7 @@
 
 
 #include <linux/device.h>
+#include <asm/unaligned.h>
 #include <linux/hid.h>
 #include <linux/module.h>
 #include <linux/usb.h>
@@ -273,8 +274,8 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
 		goto dj_device_allocate_fail;
 	}
 
-	dj_dev->reports_supported = le32_to_cpu(
-		dj_report->report_params[DEVICE_PAIRED_RF_REPORT_TYPE]);
+	dj_dev->reports_supported = get_unaligned_le32(
+		dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE);
 	dj_dev->hdev = dj_hiddev;
 	dj_dev->dj_receiver_dev = djrcv_dev;
 	dj_dev->device_index = dj_report->device_index;
@@ -618,9 +619,18 @@ static int logi_dj_raw_event(struct hid_device *hdev,
 	struct dj_report *dj_report = (struct dj_report *) data;
 	unsigned long flags;
 	bool report_processed = false;
+	char buf[32 * 3 + 1];
+	int i;
 
 	dbg_hid("%s, size:%d\n", __func__, size);
 
+	if (0 < size && size <= 32) {
+		for (i = 0; i < size; i++)
+			snprintf(buf + 3*i, sizeof(buf) - 3*i,
+					" %02x", data[i]);
+		dbg_hid("%s: report = %s\n", __func__, buf);
+	}
+
 	/* Here we receive all data coming from iface 2, there are 4 cases:
 	 *
 	 * 1) Data should continue its normal processing i.e. data does not
Do I need to apply only this patch, or both the previous one and this one?


-- 
Hugo Osvaldo Barrera

Re: [bug?] [powerpc] hid_logitech_dj: Wireless mouse does not work in xorg or gpm

From: Jonathan Nieder <hidden>
Date: 2012-05-06 06:23:23

Hugo Osvaldo Barrera wrote:
On 2012-05-06 02:55, Jonathan Nieder wrote:
quoted
The pairing (...add_djhid_device) happens during initialization,
before the mouse is turned on...
I don't think I quite follow there.  By "pairing" I though you meant
when the receiver connects to the mouse.  How can the pairing be done
while the device is off?  Or what am I missing here?
I'm guessing the actual pairing happens without Linux being involved.
Then the driver sends a "get paired devices" request during
initialization and the device sends the "device paired" notifications
I'm interested in in response.
Do I need to apply only this patch, or both the previous one and this one?
Only this patch.

Cheers,
Jonathan

Re: [bug?] [powerpc] hid_logitech_dj: Wireless mouse does not work in xorg or gpm

From: Hugo Osvaldo Barrera <hidden>
Date: 2012-05-11 05:06:19

On 2012.05.06 01:23, Jonathan Nieder wrote:
Hugo Osvaldo Barrera wrote:
quoted
On 2012-05-06 02:55, Jonathan Nieder wrote:
quoted
quoted
The pairing (...add_djhid_device) happens during initialization,
before the mouse is turned on...
I don't think I quite follow there.  By "pairing" I though you meant
when the receiver connects to the mouse.  How can the pairing be done
while the device is off?  Or what am I missing here?
I'm guessing the actual pairing happens without Linux being involved.
Then the driver sends a "get paired devices" request during
initialization and the device sends the "device paired" notifications
I'm interested in in response.
quoted
Do I need to apply only this patch, or both the previous one and this one?
Only this patch.

Cheers,
Jonathan
Hi!
I apologize for the really (really) long delay in replying.  I've had a
really busy week. I rebuilt the kernel with the patch (rebuilding the
module did't work because I'd updated the kernel tree, and the re-built
module wasn't recognized):

# uname -a
Linux athena 3.4.0-rc5+ #1 Fri May 4 19:14:24 ART 2012 ppc GNU/Linux

And I captured the dmesg from before plugging in the mouse (after a
clean reboot).
The good news is there's a "41" event this time! :)

/sys/kernel/debug/hid/ is empty at this point, so I can't cat /sys/... .../events



[  365.757237] usbcore: registered new interface driver usbhid
[  365.757448] usbhid: USB HID core driver
[  365.761458] drivers/hid/hid-logitech-dj.c: Logitech-DJ:logi_dj_init
[  528.822188] usb 4-1: new full-speed USB device number 2 using ohci_hcd
[  529.044194] usb 4-1: New USB device found, idVendor=046d, idProduct=c52b
[  529.044417] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  529.044646] usb 4-1: Product: USB Receiver
[  529.044783] usb 4-1: Manufacturer: Logitech
[  529.054294] drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 0
[  529.054436] drivers/hid/hid-logitech-dj.c: logi_dj_probe called for ifnum 0
[  529.054442] drivers/hid/hid-logitech-dj.c: logi_dj_probe: ignoring ifnum 0
[  529.054561] drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 1
[  529.054658] drivers/hid/hid-logitech-dj.c: logi_dj_probe called for ifnum 1
[  529.054664] drivers/hid/hid-logitech-dj.c: logi_dj_probe: ignoring ifnum 1
[  529.054754] drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 2
[  529.054852] drivers/hid/hid-logitech-dj.c: logi_dj_probe called for ifnum 2
[  529.061218] drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x1001 wIndex=0x0200 wLength=1792
[  529.063218] drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x1101 wIndex=0x0200 wLength=5120
[  529.064204] drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x2001 wIndex=0x0200 wLength=3840
[  529.065199] drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x2101 wIndex=0x0200 wLength=8192
[  529.066942] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0001:10:1b.1-1/input2
[  529.073214] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[  529.073230] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event: report =  20 01 41 01 1a 10 04 00 00 00 00 00 00 00 00
[  529.073277] drivers/hid/hid-logitech-dj.c: delayedwork_callback
[  529.073447] drivers/hid/hid-logitech-dj.c: logi_dj_ll_parse
[  529.073453] drivers/hid/hid-logitech-dj.c: logi_dj_ll_parse: sending a mouse descriptor, reports_supported: 4
[  529.074068] drivers/hid/hid-logitech-dj.c: logi_dj_ll_start
[  529.074276] input: Logitech Unifying Device. Wireless PID:101a as /devices/pci0001:10/0001:10:1b.1/usb4/4-1/4-1:1.2/0003:046D:C52B.0003/input/input5
[  529.075216] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[  529.075229] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event: report =  20 00 41 02 00 00 00 00 00 00 00 00 00 00 00
[  529.075854] drivers/hid/hid-logitech-dj.c: logi_dj_ll_open:usb-0001:10:1b.1-1:1
[  529.075887] drivers/hid/hid-logitech-dj.c: logi_dj_ll_close:usb-0001:10:1b.1-1:1
[  529.075929] drivers/hid/hid-logitech-dj.c: logi_dj_ll_open:usb-0001:10:1b.1-1:1
[  529.075966] drivers/hid/hid-logitech-dj.c: logi_dj_ll_close:usb-0001:10:1b.1-1:1
[  529.076072] logitech-djdevice 0003:046D:C52B.0004: input,hidraw1: USB HID v1.11 Mouse [Logitech Unifying Device. Wireless PID:101a] on usb-0001:10:1b.1-1:1
[  529.076547] drivers/hid/hid-logitech-dj.c: delayedwork_callback
[  529.076554] drivers/hid/hid-logitech-dj.c: logi_dj_recv_add_djhid_device: device list is empty

<receiver plugged in>

[  593.872745] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[  593.872760] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event: report =  20 01 42 00 00 00 00 00 00 00 00 00 00 00 00
<mouse turned on>


Since /sys/kernel/debug/hid/ is empty until I plug in the receiver, I
can't cat the events until then. The output of the events is the same 
as before when I turned on the mouse (I'm thinking you won't need this,
but I'd rather be sure).

# cat /sys/kernel/debug/hid/0003\:046D\:C52B.0003/events 
report (size 15) (numbered) =  20 01 42 00 00 00 00 00 00 00 00 00 00 00 00

-----

JUST as I was about to send this e-mail, I was reading the output of
that dmesg and noticed that a few more /inputX devices were mentioned,
so I decided to actually try the mouse, something that I'd neglected
to do this last round (I though this patch only added debuging output).

The mouse actually works now on Xorg just fine. :)

A big thanks (truly) for all your effort on this.  I'm still including
the above info because I'm not sure if it's of use to you or not.

Cheers,

Hugo

Re: [bug?] [powerpc] hid_logitech_dj: Wireless mouse does not work in xorg or gpm

From: Nestor Lopez Casado <hidden>
Date: 2012-05-11 06:38:58

Great news. Thanks Hugo for your help testing the patches.

Jonathan, how do we proceed now, I mean to submit the fix ?

Thanks,
Nestor

On Fri, May 11, 2012 at 7:06 AM, Hugo Osvaldo Barrera
[off-list ref] wrote:
On 2012.05.06 01:23, Jonathan Nieder wrote:
quoted
Hugo Osvaldo Barrera wrote:
quoted
On 2012-05-06 02:55, Jonathan Nieder wrote:
quoted
quoted
The pairing (...add_djhid_device) happens during initialization,
before the mouse is turned on...
I don't think I quite follow there.  By "pairing" I though you meant
when the receiver connects to the mouse.  How can the pairing be done
while the device is off?  Or what am I missing here?
I'm guessing the actual pairing happens without Linux being involved.
Then the driver sends a "get paired devices" request during
initialization and the device sends the "device paired" notifications
I'm interested in in response.
quoted
Do I need to apply only this patch, or both the previous one and this one?
Only this patch.

Cheers,
Jonathan
Hi!
I apologize for the really (really) long delay in replying.  I've had a
really busy week. I rebuilt the kernel with the patch (rebuilding the
module did't work because I'd updated the kernel tree, and the re-built
module wasn't recognized):

# uname -a
Linux athena 3.4.0-rc5+ #1 Fri May 4 19:14:24 ART 2012 ppc GNU/Linux

And I captured the dmesg from before plugging in the mouse (after a
clean reboot).
The good news is there's a "41" event this time! :)

/sys/kernel/debug/hid/ is empty at this point, so I can't cat /sys/... .../events



[  365.757237] usbcore: registered new interface driver usbhid
[  365.757448] usbhid: USB HID core driver
[  365.761458] drivers/hid/hid-logitech-dj.c: Logitech-DJ:logi_dj_init
[  528.822188] usb 4-1: new full-speed USB device number 2 using ohci_hcd
[  529.044194] usb 4-1: New USB device found, idVendor=046d, idProduct=c52b
[  529.044417] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  529.044646] usb 4-1: Product: USB Receiver
[  529.044783] usb 4-1: Manufacturer: Logitech
[  529.054294] drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 0
[  529.054436] drivers/hid/hid-logitech-dj.c: logi_dj_probe called for ifnum 0
[  529.054442] drivers/hid/hid-logitech-dj.c: logi_dj_probe: ignoring ifnum 0
[  529.054561] drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 1
[  529.054658] drivers/hid/hid-logitech-dj.c: logi_dj_probe called for ifnum 1
[  529.054664] drivers/hid/hid-logitech-dj.c: logi_dj_probe: ignoring ifnum 1
[  529.054754] drivers/hid/usbhid/hid-core.c: HID probe called for ifnum 2
[  529.054852] drivers/hid/hid-logitech-dj.c: logi_dj_probe called for ifnum 2
[  529.061218] drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x1001 wIndex=0x0200 wLength=1792
[  529.063218] drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x1101 wIndex=0x0200 wLength=5120
[  529.064204] drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x2001 wIndex=0x0200 wLength=3840
[  529.065199] drivers/hid/usbhid/hid-core.c: submitting ctrl urb: Get_Report wValue=0x2101 wIndex=0x0200 wLength=8192
[  529.066942] logitech-djreceiver 0003:046D:C52B.0003: hiddev0,hidraw0: USB HID v1.11 Device [Logitech USB Receiver] on usb-0001:10:1b.1-1/input2
[  529.073214] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[  529.073230] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event: report =  20 01 41 01 1a 10 04 00 00 00 00 00 00 00 00
[  529.073277] drivers/hid/hid-logitech-dj.c: delayedwork_callback
[  529.073447] drivers/hid/hid-logitech-dj.c: logi_dj_ll_parse
[  529.073453] drivers/hid/hid-logitech-dj.c: logi_dj_ll_parse: sending a mouse descriptor, reports_supported: 4
[  529.074068] drivers/hid/hid-logitech-dj.c: logi_dj_ll_start
[  529.074276] input: Logitech Unifying Device. Wireless PID:101a as /devices/pci0001:10/0001:10:1b.1/usb4/4-1/4-1:1.2/0003:046D:C52B.0003/input/input5
[  529.075216] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[  529.075229] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event: report =  20 00 41 02 00 00 00 00 00 00 00 00 00 00 00
[  529.075854] drivers/hid/hid-logitech-dj.c: logi_dj_ll_open:usb-0001:10:1b.1-1:1
[  529.075887] drivers/hid/hid-logitech-dj.c: logi_dj_ll_close:usb-0001:10:1b.1-1:1
[  529.075929] drivers/hid/hid-logitech-dj.c: logi_dj_ll_open:usb-0001:10:1b.1-1:1
[  529.075966] drivers/hid/hid-logitech-dj.c: logi_dj_ll_close:usb-0001:10:1b.1-1:1
[  529.076072] logitech-djdevice 0003:046D:C52B.0004: input,hidraw1: USB HID v1.11 Mouse [Logitech Unifying Device. Wireless PID:101a] on usb-0001:10:1b.1-1:1
[  529.076547] drivers/hid/hid-logitech-dj.c: delayedwork_callback
[  529.076554] drivers/hid/hid-logitech-dj.c: logi_dj_recv_add_djhid_device: device list is empty

<receiver plugged in>

[  593.872745] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event, size:15
[  593.872760] drivers/hid/hid-logitech-dj.c: logi_dj_raw_event: report =  20 01 42 00 00 00 00 00 00 00 00 00 00 00 00
<mouse turned on>


Since /sys/kernel/debug/hid/ is empty until I plug in the receiver, I
can't cat the events until then. The output of the events is the same
as before when I turned on the mouse (I'm thinking you won't need this,
but I'd rather be sure).

# cat /sys/kernel/debug/hid/0003\:046D\:C52B.0003/events
report (size 15) (numbered) =  20 01 42 00 00 00 00 00 00 00 00 00 00 00 00

-----

JUST as I was about to send this e-mail, I was reading the output of
that dmesg and noticed that a few more /inputX devices were mentioned,
so I decided to actually try the mouse, something that I'd neglected
to do this last round (I though this patch only added debuging output).

The mouse actually works now on Xorg just fine. :)

A big thanks (truly) for all your effort on this.  I'm still including
the above info because I'm not sure if it's of use to you or not.

Cheers,

Hugo
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[PATCH/RFC] HID: logitech: read all 32 bits of report type bitfield

From: Jonathan Nieder <hidden>
Date: 2012-05-11 07:22:43

On big-endian systems (e.g., Apple PowerBook), trying to use a
logitech wireless mouse with the Logitech Unifying Receiver does not
work with v3.2 and later kernels.  The device doesn't show up in
/dev/input.  Older kernels work fine.

That is because the new hid-logitech-dj driver claims the device.  The
device arrival notification appears:

	20 00 41 02 00 00 00 00 00 00 00 00 00 00 00

and we read the report_types bitfield (02 00 00 00) to find out what
kind of device it is.  Unfortunately the driver only reads the first 8
bits and treats that value as a 32-bit little-endian number, so on a
powerpc the report type seems to be 0x02000000 and is not recognized.

Even on little-endian machines, connecting a media center remote
control (report type 00 01 00 00) with this driver loaded would
presumably fail for the same reason.

Fix both problems by using get_unaligned_le32() to read all four
bytes, which is a little clearer anyway.  After this change, the
wireless mouse works on Hugo's PowerBook again.

Based on a patch by Nestor Lopez Casado.
Addresses http://bugs.debian.org/671292

Reported-by: Hugo Osvaldo Barrera <redacted>
Inspired-by: Nestor Lopez Casado [off-list ref]
Signed-off-by: Jonathan Nieder <redacted>
Cc: <redacted>
---
Nestor Lopez Casado wrote:
Great news. Thanks Hugo for your help testing the patches.

Jonathan, how do we proceed now, I mean to submit the fix ?
If the patch looks good to you, we ask Jiri to pick it up.  What do
you think?

Thanks,
Jonathan

 drivers/hid/hid-logitech-dj.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 38b12e45780c..2eac8c566b17 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -26,6 +26,7 @@
 #include <linux/hid.h>
 #include <linux/module.h>
 #include <linux/usb.h>
+#include <asm/unaligned.h>
 #include "usbhid/usbhid.h"
 #include "hid-ids.h"
 #include "hid-logitech-dj.h"
@@ -265,8 +266,8 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
 		goto dj_device_allocate_fail;
 	}
 
-	dj_dev->reports_supported = le32_to_cpu(
-		dj_report->report_params[DEVICE_PAIRED_RF_REPORT_TYPE]);
+	dj_dev->reports_supported = get_unaligned_le32(
+		dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE);
 	dj_dev->hdev = dj_hiddev;
 	dj_dev->dj_receiver_dev = djrcv_dev;
 	dj_dev->device_index = dj_report->device_index;
-- 
1.7.10.1

Re: [PATCH/RFC] HID: logitech: read all 32 bits of report type bitfield

From: Nestor Lopez Casado <hidden>
Date: 2012-05-11 07:36:40

The patch looks perfect to me. Wonderful 'get_unaligned_le32' that I
looked for and did not find when trying to fix the original code.

On my side no issues for Jiri to apply it.

Thanks again Jonathan and Hugo.

Cheers,
Nestor.

On Fri, May 11, 2012 at 9:22 AM, Jonathan Nieder [off-list ref] wrote:
quoted hunk
On big-endian systems (e.g., Apple PowerBook), trying to use a
logitech wireless mouse with the Logitech Unifying Receiver does not
work with v3.2 and later kernels.  The device doesn't show up in
/dev/input.  Older kernels work fine.

That is because the new hid-logitech-dj driver claims the device.  The
device arrival notification appears:

       20 00 41 02 00 00 00 00 00 00 00 00 00 00 00

and we read the report_types bitfield (02 00 00 00) to find out what
kind of device it is.  Unfortunately the driver only reads the first 8
bits and treats that value as a 32-bit little-endian number, so on a
powerpc the report type seems to be 0x02000000 and is not recognized.

Even on little-endian machines, connecting a media center remote
control (report type 00 01 00 00) with this driver loaded would
presumably fail for the same reason.

Fix both problems by using get_unaligned_le32() to read all four
bytes, which is a little clearer anyway.  After this change, the
wireless mouse works on Hugo's PowerBook again.

Based on a patch by Nestor Lopez Casado.
Addresses http://bugs.debian.org/671292

Reported-by: Hugo Osvaldo Barrera <redacted>
Inspired-by: Nestor Lopez Casado [off-list ref]
Signed-off-by: Jonathan Nieder <redacted>
Cc: <redacted>
---
Nestor Lopez Casado wrote:
quoted
Great news. Thanks Hugo for your help testing the patches.

Jonathan, how do we proceed now, I mean to submit the fix ?
If the patch looks good to you, we ask Jiri to pick it up.  What do
you think?

Thanks,
Jonathan

 drivers/hid/hid-logitech-dj.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 38b12e45780c..2eac8c566b17 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -26,6 +26,7 @@
 #include <linux/hid.h>
 #include <linux/module.h>
 #include <linux/usb.h>
+#include <asm/unaligned.h>
 #include "usbhid/usbhid.h"
 #include "hid-ids.h"
 #include "hid-logitech-dj.h"
@@ -265,8 +266,8 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
               goto dj_device_allocate_fail;
       }

-       dj_dev->reports_supported = le32_to_cpu(
-               dj_report->report_params[DEVICE_PAIRED_RF_REPORT_TYPE]);
+       dj_dev->reports_supported = get_unaligned_le32(
+               dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE);
       dj_dev->hdev = dj_hiddev;
       dj_dev->dj_receiver_dev = djrcv_dev;
       dj_dev->device_index = dj_report->device_index;
--
1.7.10.1
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[PATCH/RFC v2] HID: logitech: read all 32 bits of report type bitfield

From: Jonathan Nieder <hidden>
Date: 2012-05-11 07:39:34

From: Nestor Lopez Casado <redacted>

On big-endian systems (e.g., Apple PowerBook), trying to use a
logitech wireless mouse with the Logitech Unifying Receiver does not
work with v3.2 and later kernels.  The device doesn't show up in
/dev/input.  Older kernels work fine.

That is because the new hid-logitech-dj driver claims the device.  The
device arrival notification appears:

	20 00 41 02 00 00 00 00 00 00 00 00 00 00 00

and we read the report_types bitfield (02 00 00 00) to find out what
kind of device it is.  Unfortunately the driver only reads the first 8
bits and treats that value as a 32-bit little-endian number, so on a
powerpc the report type seems to be 0x02000000 and is not recognized.

Even on little-endian machines, connecting a media center remote
control (report type 00 01 00 00) with this driver loaded would
presumably fail for the same reason.

Fix both problems by using get_unaligned_le32() to read all four
bytes, which is a little clearer anyway.  After this change, the
wireless mouse works on Hugo's PowerBook again.

Addresses http://bugs.debian.org/671292

[jn: with commit message and tweaked to use get_unaligned instead of
 copying onto the stack]

Reported-by: Hugo Osvaldo Barrera <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Cc: <redacted>
---
Change since v1: fixed attribution.

I had been wondering why the patch you sent before didn't fix Hugo's
problem while the effectively identical patch I sent did.  The only
explanation I can think of is an error introduced in applying the
patch by hand.

 drivers/hid/hid-logitech-dj.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 38b12e45780c..2eac8c566b17 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -26,6 +26,7 @@
 #include <linux/hid.h>
 #include <linux/module.h>
 #include <linux/usb.h>
+#include <asm/unaligned.h>
 #include "usbhid/usbhid.h"
 #include "hid-ids.h"
 #include "hid-logitech-dj.h"
@@ -265,8 +266,8 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
 		goto dj_device_allocate_fail;
 	}
 
-	dj_dev->reports_supported = le32_to_cpu(
-		dj_report->report_params[DEVICE_PAIRED_RF_REPORT_TYPE]);
+	dj_dev->reports_supported = get_unaligned_le32(
+		dj_report->report_params + DEVICE_PAIRED_RF_REPORT_TYPE);
 	dj_dev->hdev = dj_hiddev;
 	dj_dev->dj_receiver_dev = djrcv_dev;
 	dj_dev->device_index = dj_report->device_index;
-- 
1.7.10.1

Re: [PATCH/RFC] HID: logitech: read all 32 bits of report type bitfield

From: Jonathan Nieder <hidden>
Date: 2012-05-11 07:43:07

Nestor Lopez Casado wrote:
The patch looks perfect to me. Wonderful 'get_unaligned_le32' that I
looked for and did not find when trying to fix the original code.

On my side no issues for Jiri to apply it.
Nice to hear.  Thanks again for all your help.

Ciao,
Jonathan

Re: [PATCH/RFC v2] HID: logitech: read all 32 bits of report type bitfield

From: Jiri Kosina <hidden>
Date: 2012-05-11 10:55:27

On Fri, 11 May 2012, Jonathan Nieder wrote:
From: Nestor Lopez Casado <redacted>

On big-endian systems (e.g., Apple PowerBook), trying to use a
logitech wireless mouse with the Logitech Unifying Receiver does not
work with v3.2 and later kernels.  The device doesn't show up in
/dev/input.  Older kernels work fine.

That is because the new hid-logitech-dj driver claims the device.  The
device arrival notification appears:

	20 00 41 02 00 00 00 00 00 00 00 00 00 00 00

and we read the report_types bitfield (02 00 00 00) to find out what
kind of device it is.  Unfortunately the driver only reads the first 8
bits and treats that value as a 32-bit little-endian number, so on a
powerpc the report type seems to be 0x02000000 and is not recognized.

Even on little-endian machines, connecting a media center remote
control (report type 00 01 00 00) with this driver loaded would
presumably fail for the same reason.

Fix both problems by using get_unaligned_le32() to read all four
bytes, which is a little clearer anyway.  After this change, the
wireless mouse works on Hugo's PowerBook again.

Addresses http://bugs.debian.org/671292

[jn: with commit message and tweaked to use get_unaligned instead of
 copying onto the stack]

Reported-by: Hugo Osvaldo Barrera <redacted>
Signed-off-by: Jonathan Nieder <redacted>
If Nestor is really the original author of this patch, his Signed-off-by: 
is necessary.

Nestor, please?

Thanks,

-- 
Jiri Kosina
SUSE Labs

Re: [PATCH/RFC v2] HID: logitech: read all 32 bits of report type bitfield

From: Hugo Osvaldo Barrera <hidden>
Date: 2012-05-11 12:49:54

On 2012-05-11 04:39, Jonathan Nieder wrote:
From: Nestor Lopez Casado <redacted>

On big-endian systems (e.g., Apple PowerBook), trying to use a
logitech wireless mouse with the Logitech Unifying Receiver does not
work with v3.2 and later kernels.  The device doesn't show up in
/dev/input.  Older kernels work fine.

That is because the new hid-logitech-dj driver claims the device.  The
device arrival notification appears:

	20 00 41 02 00 00 00 00 00 00 00 00 00 00 00

and we read the report_types bitfield (02 00 00 00) to find out what
kind of device it is.  Unfortunately the driver only reads the first 8
bits and treats that value as a 32-bit little-endian number, so on a
powerpc the report type seems to be 0x02000000 and is not recognized.

Even on little-endian machines, connecting a media center remote
control (report type 00 01 00 00) with this driver loaded would
presumably fail for the same reason.

Fix both problems by using get_unaligned_le32() to read all four
bytes, which is a little clearer anyway.  After this change, the
wireless mouse works on Hugo's PowerBook again.

Addresses http://bugs.debian.org/671292

[jn: with commit message and tweaked to use get_unaligned instead of
 copying onto the stack]

Reported-by: Hugo Osvaldo Barrera <redacted>
Signed-off-by: Jonathan Nieder <redacted>
Cc: <redacted>
---
Change since v1: fixed attribution.

I had been wondering why the patch you sent before didn't fix Hugo's
problem while the effectively identical patch I sent did.  The only
explanation I can think of is an error introduced in applying the
patch by hand.
<patch snipped>

I'd hate to think I screwed up applying such a simple patch, but it's
the only thing I can think of as well.

Thanks again to both of you for your time and effort, and for your
timely responses on this issue!

I hope this makes it to the main branch soon!

Cheers, and good luck to both,

-- 
Hugo Osvaldo Barrera
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help