All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien BLACHE <jb@jblache.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@suse.de>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Jiri Kosina <jkosina@suse.cz>
Subject: [PATCH] Fix USB vendor and product IDs endianness for USB HID devices
Date: Sat, 10 Feb 2007 22:08:50 +0100	[thread overview]
Message-ID: <87k5yp90v1.fsf@sonic.technologeek.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

Hi,

The generic HID layer changes introduced an endianness bug for USB HID
devices.

The USB vendor and product IDs are not byteswapped appropriately, and
thus come out in the wrong endianness when fetched through the evdev
using ioctl() on big endian platforms.

This byteswapping used to be done in hidinput_connect() (by
usb_to_input_id()) when filling up the hid device structure, and now
needs to be done upstream. USB is the only user so far, and the
hid_device structure is set up in usb_hid_configure().


Signed-off-by: Julien BLACHE <jb@jblache.org>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Fix USB vendor and product IDs endianness for USB HID devices --]
[-- Type: text/x-diff, Size: 498 bytes --]

--- hid-core.c~	2007-02-05 11:16:33.905278861 +0100
+++ hid-core.c	2007-02-10 21:53:52.366333019 +0100
@@ -1220,8 +1220,8 @@
 			 le16_to_cpu(dev->descriptor.idProduct));
 
 	hid->bus = BUS_USB;
-	hid->vendor = dev->descriptor.idVendor;
-	hid->product = dev->descriptor.idProduct;
+	hid->vendor = le16_to_cpu(dev->descriptor.idVendor);
+	hid->product = le16_to_cpu(dev->descriptor.idProduct);
 
 	usb_make_path(dev, hid->phys, sizeof(hid->phys));
 	strlcat(hid->phys, "/input", sizeof(hid->phys));

[-- Attachment #3: Type: text/plain, Size: 255 bytes --]



Please apply, and this is a candidate for -stable as it breaks a
documented API/ABI in userspace.

JB.

-- 
Julien BLACHE                                   <http://www.jblache.org> 
<jb@jblache.org>                                  GPG KeyID 0xF5D65169

             reply	other threads:[~2007-02-10 21:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-10 21:08 Julien BLACHE [this message]
2007-02-11 17:24 ` [PATCH] Fix USB vendor and product IDs endianness for USB HID devices Jiri Kosina
2007-02-11 18:04   ` Julien BLACHE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k5yp90v1.fsf@sonic.technologeek.org \
    --to=jb@jblache.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@suse.de \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.