* [PATCH v2 1/1] HID: logitech: read all 32 bits of report type bitfield
@ 2012-05-11 14:17 Nestor Lopez Casado
2012-05-11 14:32 ` Jiri Kosina
2012-05-12 0:44 ` Jonathan Nieder
0 siblings, 2 replies; 3+ messages in thread
From: Nestor Lopez Casado @ 2012-05-11 14:17 UTC (permalink / raw)
To: jrnieder
Cc: Jiri Kosina, Benjamin Tissoires, linux-input, linux-kernel, hugo,
671292, stable, Nestor Lopez Casado
From: Jonathan Nieder <jrnieder@gmail.com>
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 <hugo@osvaldobarrera.com.ar>
Inspired-by: Nestor Lopez Casado <nlopezcasad@logitech.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nestor Lopez Casado <nlopezcasad@logitech.com>
Cc: <stable@vger.kernel.org>
---
drivers/hid/hid-logitech-dj.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 2b56efc..d44ea58 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.5.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] HID: logitech: read all 32 bits of report type bitfield
2012-05-11 14:17 [PATCH v2 1/1] HID: logitech: read all 32 bits of report type bitfield Nestor Lopez Casado
@ 2012-05-11 14:32 ` Jiri Kosina
2012-05-12 0:44 ` Jonathan Nieder
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2012-05-11 14:32 UTC (permalink / raw)
To: Nestor Lopez Casado
Cc: jrnieder, Benjamin Tissoires, linux-input, linux-kernel, hugo,
671292, stable
On Fri, 11 May 2012, Nestor Lopez Casado wrote:
> From: Jonathan Nieder <jrnieder@gmail.com>
>
> 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.
Applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] HID: logitech: read all 32 bits of report type bitfield
2012-05-11 14:17 [PATCH v2 1/1] HID: logitech: read all 32 bits of report type bitfield Nestor Lopez Casado
2012-05-11 14:32 ` Jiri Kosina
@ 2012-05-12 0:44 ` Jonathan Nieder
1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Nieder @ 2012-05-12 0:44 UTC (permalink / raw)
To: Nestor Lopez Casado
Cc: Jiri Kosina, Benjamin Tissoires, linux-input, linux-kernel, hugo,
671292, stable
Nestor Lopez Casado wrote:
> From: Jonathan Nieder <jrnieder@gmail.com>
>
> 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.
Sigh, I took the wrong line in this example. The above event is
"device list empty" and report_types is 0 as you'd expect. The
example I meant to use:
20 01 41 01 1a 10 04 00 00 00 00 00 00 00 00
and we read the report_types bitfield (04 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 0x04000000 and is not recognized.
Jiri, please amend the message if convenient, or I'm fine with leaving
it be if not. Sorry for the nonsense.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-12 0:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-11 14:17 [PATCH v2 1/1] HID: logitech: read all 32 bits of report type bitfield Nestor Lopez Casado
2012-05-11 14:32 ` Jiri Kosina
2012-05-12 0:44 ` Jonathan Nieder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).