Re: [PATCH 01/10] modpost: add support for hid

Previous thread: thinkpad_acpi: fix possible NULL pointer dereference if kstrdup for ec_version_str failed by Jan Lieskovsky on Friday, May 16, 2008 - 5:34 am. (2 messages)

Next thread: [PATCH] Bsdacct: stir up comments around acct_process. by Pavel Emelyanov on Friday, May 16, 2008 - 6:54 am. (2 messages)
To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jirislaby@...>
Date: Friday, May 16, 2008 - 5:49 am

Generate aliases for hid device modules to support autoloading.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
include/linux/hid.h | 1 +
include/linux/mod_devicetable.h | 9 +++++++++
scripts/mod/file2alias.c | 18 ++++++++++++++++++
3 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index 6fc10d1..8466292 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -69,6 +69,7 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/list.h>
+#include <linux/mod_devicetable.h> /* hid_device_id */
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/input.h>
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index d73ecea..72d34c1 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -131,6 +131,15 @@ struct usb_device_id {
#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200

+#define HID_ANY_ID (~0)
+
+struct hid_device_id {
+ __u16 bus;
+ __u32 vendor;
+ __u32 product;
+ kernel_ulong_t driver_data;
+};
+
/* s390 CCW devices */
struct ccw_device_id {
__u16 match_flags; /* which fields to match against */
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index e04c421..a19e385 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -199,6 +199,20 @@ static void do_usb_table(void *symval, unsigned long size,
do_usb_entry_multi(symval + i, mod);
}

+/* Looks like: hid:bNvNpN */
+static int do_hid_entry(const char *filename,
+ struct hid_device_id *id, char *alias)
+{
+ id->vendor = TO_NATIVE(id->vendor);
+ id->product = TO_NATIVE(id->product);
+
+ sprintf(alias, "hid:b%04X", id->bus);
+ ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor);
+ ADD(alias, "p", id->product != HID_ANY_ID, id->product);
+
+ retu...

To: Jiri Slaby <jirislaby@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Thursday, June 5, 2008 - 5:26 am

Jiri,

I have rebased the patch series on top of current state of the queued
patches in my tree and applied them to 'hidbus' branch of my tree. So you
can base any further respins of the patches on the version you can find in
this branch right now.

I have not yet pulled that branch into the branch that is pulled into -mm
and linux-next, there are some things that I think still need sorting out
-- I have sent you some feedback yesterday.

Thanks a lot,

--
Jiri Kosina
SUSE Labs
--

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Monday, June 9, 2008 - 6:41 am

Thanks a lot for the review!
--

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jirislaby@...>
Date: Monday, May 19, 2008 - 9:50 am

Generate aliases for hid device modules to support autoloading.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
include/linux/hid.h | 1 +
include/linux/mod_devicetable.h | 10 ++++++++++
scripts/mod/file2alias.c | 18 ++++++++++++++++++
3 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index 6fc10d1..8466292 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -69,6 +69,7 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/list.h>
+#include <linux/mod_devicetable.h> /* hid_device_id */
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/input.h>
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index d73ecea..3511694 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -131,6 +131,16 @@ struct usb_device_id {
#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200

+#define HID_ANY_ID (~0)
+
+struct hid_device_id {
+ __u16 bus;
+ __u32 vendor;
+ __u32 product;
+ kernel_ulong_t driver_data
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
/* s390 CCW devices */
struct ccw_device_id {
__u16 match_flags; /* which fields to match against */
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index cea4a79..383af1b 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -206,6 +206,20 @@ static void do_usb_table(void *symval, unsigned long size,
do_usb_entry_multi(symval + i, mod);
}

+/* Looks like: hid:bNvNpN */
+static int do_hid_entry(const char *filename,
+ struct hid_device_id *id, char *alias)
+{
+ id->vendor = TO_NATIVE(id->vendor);
+ id->product = TO_NATIVE(id->product);
+
+ sprintf(alias, "hid:b%04X", id->bus);
+ ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor);
+ ADD(alias, "p", id-...

To: Jiri Slaby <jirislaby@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Monday, May 19, 2008 - 9:36 am

Hi Jiri,

thanks for rebasing the series and fixing the comments raised during
review.

However, I seem to miss the 10/10 patch from this series, and it doesn't
seem to be even in my lkml/linux-input folder.

Thanks,

--
Jiri Kosina
SUSE Labs
--

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Monday, May 19, 2008 - 9:38 am

BTW. this patch (01) needs fix. It breaks crossbuilds. I will repost the 01
--

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jirislaby@...>, Jiri Slaby <jslaby@...>
Date: Friday, May 16, 2008 - 5:49 am

Make a bus from hid core. This is the first step for converting all the
quirks and separate almost-drivers into real drivers attached to this bus.

It's implemented to change behaviour in very tiny manner, so that no driver
needs to be changed this time.

Also add generic drivers for both usb and bt into usbhid or hidp
respectively which will bind all non-blacklisted device. Those blacklisted
will be either grabbed by special drivers or by nobody if they are broken at
the very rude base.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/hid/hid-core.c | 470 ++++++++++++++++++++++++++++++++++-------
drivers/hid/hid-input.c | 2 +-
drivers/hid/usbhid/hid-core.c | 44 +++-
drivers/hid/usbhid/usbhid.h | 2 +-
include/linux/hid.h | 100 ++++++++-
net/bluetooth/hidp/core.c | 64 +++++-
6 files changed, 578 insertions(+), 104 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index f43d6d3..2bf7561 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -534,9 +534,10 @@ static void hid_free_report(struct hid_report *report)
* Free a device structure, all reports, and all fields.
*/

-void hid_free_device(struct hid_device *device)
+static void hid_device_release(struct device *dev)
{
- unsigned i,j;
+ struct hid_device *device = container_of(dev, struct hid_device, dev);
+ unsigned i, j;

for (i = 0; i < HID_REPORT_TYPES; i++) {
struct hid_report_enum *report_enum = device->report_enum + i;
@@ -552,7 +553,6 @@ void hid_free_device(struct hid_device *device)
kfree(device->collection);
kfree(device);
}
-EXPORT_SYMBOL_GPL(hid_free_device);

/*
* Fetch a report description item from the data stream. We support long
@@ -622,18 +622,24 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
return NULL;
}

-/*
+/**
+ * hid_parse_report - parse device report
+ *
+ * @device: hid device
+ * @start: report start
+ * @size: report size...

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jirislaby@...>, Jiri Slaby <jslaby@...>
Date: Friday, May 16, 2008 - 5:49 am

Next step for complete hid bus, this patch includes:
- call parser either from probe or from hid-core if there is no probe.
- add ll_driver structure and centralize some stuff there (open, close...)
- split and merge usb_hid_configure and hid_probe into several functions
to allow hooks/fixes between them

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/hid/hid-core.c | 24 ++-
drivers/hid/hid-input.c | 16 ++-
drivers/hid/hidraw.c | 6 +-
drivers/hid/usbhid/hid-core.c | 330 ++++++++++++++++++++++++-----------------
include/linux/hid.h | 94 +++++++++++-
net/bluetooth/hidp/core.c | 191 ++++++++++++++----------
net/bluetooth/hidp/hidp.h | 2 +
7 files changed, 424 insertions(+), 239 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 2bf7561..984d5d8 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -648,6 +648,9 @@ int hid_parse_report(struct hid_device *device, __u8 *start,
hid_parser_reserved
};

+ if (device->driver->report_fixup)
+ device->driver->report_fixup(device, start, size);
+
device->rdesc = kmalloc(size, GFP_KERNEL);
if (device->rdesc == NULL)
return -ENOMEM;
@@ -1148,15 +1151,20 @@ static int hid_device_probe(struct device *dev)
int ret = 0;

if (!hdev->driver) {
- if (hdrv->probe) {
- ret = -ENODEV;
+ id = hid_match_id(hdev, hdrv->id_table);
+ if (id == NULL)
+ return -ENODEV;

- id = hid_match_id(hdev, hdrv->id_table);
- if (id)
- ret = hdrv->probe(hdev, id);
+ hdev->driver = hdrv;
+ if (hdrv->probe) {
+ ret = hdrv->probe(hdev, id);
+ } else { /* default probe */
+ ret = hid_parse(hdev);
+ if (!ret)
+ ret = hid_hw_start(hdev);
}
- if (!ret)
- hdev->driver = hdrv;
+ if (ret)
+ hdev->driver = NULL;
}
return ret;
}
@@ -1169,6 +1177,8 @@ static int hid_device_remove(struct device *dev)
if (hdrv) {
if (hdrv->remo...

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jirislaby@...>, Jiri Slaby <jslaby@...>
Date: Friday, May 16, 2008 - 5:49 am

Move ids from hid-quirks.c into separate file, since it will be needed in
more than one place.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/hid/hid-ids.h | 419 +++++++++++++++++++++++++++++++++++++++
drivers/hid/usbhid/hid-quirks.c | 398 +-------------------------------------
2 files changed, 420 insertions(+), 397 deletions(-)
create mode 100644 drivers/hid/hid-ids.h

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
new file mode 100644
index 0000000..5a604e4
--- /dev/null
+++ b/drivers/hid/hid-ids.h
@@ -0,0 +1,419 @@
+/*
+ * USB HID quirks support for Linux
+ *
+ * Copyright (c) 1999 Andreas Gal
+ * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
+ * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
+ * Copyright (c) 2006-2007 Jiri Kosina
+ * Copyright (c) 2007 Paul Walmsley
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#ifndef HID_IDS_H_FILE
+#define HID_IDS_H_FILE
+
+#define USB_VENDOR_ID_A4TECH 0x09da
+#define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
+#define USB_DEVICE_ID_A4TECH_X5_005D 0x000a
+
+#define USB_VENDOR_ID_AASHIMA 0x06d6
+#define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025
+#define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026
+
+#define USB_VENDOR_ID_ACECAD 0x0460
+#define USB_DEVICE_ID_ACECAD_FLAIR 0x0004
+#define USB_DEVICE_ID_ACECAD_302 0x0008
+
+#define USB_VENDOR_ID_ADS_TECH 0x06e1
+#define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155
+
+#define USB_VENDOR_ID_AFATECH 0x15a4
+#define USB_DEVICE_ID_AFATECH_AF9016 0x9016
+
+#define USB_VENDOR_ID_AIPTEK 0x08ca
+#define USB_DEVICE_ID_AIPTEK_01 0x0001
+#define USB_DEVICE_ID_AIPTEK_10 0x0010
+#define USB_DEVICE_ID_AIPTEK_20 0x0020
+#define USB_DEVICE_ID_AIPTEK_21 0x0021
+#define U...

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jirislaby@...>, Jiri Slaby <jslaby@...>
Date: Friday, May 16, 2008 - 5:49 am

This mapping are currently used on 2 placces and will be needed by more
quirk drivers, so move them to hid.h to allow them to use it.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/hid/hid-input-quirks.c | 71 ++++++++++++++++++++-------------------
drivers/hid/hid-input.c | 16 +++++----
include/linux/hid.h | 56 +++++++++++++++++++++++++++++++-
3 files changed, 100 insertions(+), 43 deletions(-)

diff --git a/drivers/hid/hid-input-quirks.c b/drivers/hid/hid-input-quirks.c
index 4c2052c..51ae184 100644
--- a/drivers/hid/hid-input-quirks.c
+++ b/drivers/hid/hid-input-quirks.c
@@ -16,16 +16,14 @@
#include <linux/input.h>
#include <linux/hid.h>

-#define map_abs(c) do { usage->code = c; usage->type = EV_ABS; *bit = input->absbit; *max = ABS_MAX; } while (0)
-#define map_rel(c) do { usage->code = c; usage->type = EV_REL; *bit = input->relbit; *max = REL_MAX; } while (0)
-#define map_key(c) do { usage->code = c; usage->type = EV_KEY; *bit = input->keybit; *max = KEY_MAX; } while (0)
-#define map_led(c) do { usage->code = c; usage->type = EV_LED; *bit = input->ledbit; *max = LED_MAX; } while (0)
+#define map_rel(c) hid_map_usage(hidinput, usage, bit, max, EV_REL, (c))
+#define map_key(c) hid_map_usage(hidinput, usage, bit, max, EV_KEY, (c))

-#define map_abs_clear(c) do { map_abs(c); clear_bit(c, *bit); } while (0)
-#define map_key_clear(c) do { map_key(c); clear_bit(c, *bit); } while (0)
+#define map_key_clear(c) hid_map_usage_clear(hidinput, usage, bit, \
+ max, EV_KEY, (c))

-static int quirk_belkin_wkbd(struct hid_usage *usage, struct input_dev *input,
- unsigned long **bit, int *max)
+static int quirk_belkin_wkbd(struct hid_usage *usage,
+ struct hid_input *hidinput, unsigned long **bit, int *max)
{
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_CONSUMER)
return 0;
@@ -40,8 +38,8 @@ static int quirk_belkin_wkbd(struct hid_usage *usa...

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jirislaby@...>, Jiri Slaby <jslaby@...>
Date: Friday, May 16, 2008 - 5:49 am

Move them from core code to a separate driver.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/hid/Kconfig | 13 +++++++
drivers/hid/Makefile | 2 +
drivers/hid/hid-core.c | 5 +++
drivers/hid/hid-logitech.c | 74 +++++++++++++++++++++++++++++++++++++++
drivers/hid/usbhid/hid-quirks.c | 23 ------------
include/linux/hid.h | 1 -
6 files changed, 94 insertions(+), 24 deletions(-)
create mode 100644 drivers/hid/hid-logitech.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index cacf89e..066e8c0 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -67,4 +67,17 @@ config HIDRAW

source "drivers/hid/usbhid/Kconfig"

+menu "Special HID drivers"
+ depends on HID
+
+config HID_LOGITECH
+ tristate "Logitech"
+ default m
+ depends on USB_HID
+ ---help---
+ Support for some Logitech devices which breaks less or more
+ HID specification.
+
+endmenu
+
endif # HID_SUPPORT
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 275dc52..cae036b 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -8,6 +8,8 @@ obj-$(CONFIG_HID) += hid.o
hid-$(CONFIG_HID_DEBUG) += hid-debug.o
hid-$(CONFIG_HIDRAW) += hidraw.o

+obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
+
obj-$(CONFIG_USB_HID) += usbhid/
obj-$(CONFIG_USB_MOUSE) += usbhid/
obj-$(CONFIG_USB_KBD) += usbhid/
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 984d5d8..4b1b814 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -33,6 +33,8 @@
#include <linux/hid-debug.h>
#include <linux/hidraw.h>

+#include "hid-ids.h"
+
/*
* Version Information
*/
@@ -1124,6 +1126,9 @@ static const struct hid_device_id *hid_match_id(struct hid_device *hdev,
}

static const struct hid_device_id hid_blacklist[] = {
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_R...

To: Jiri Slaby <jirislaby@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jslaby@...>
Date: Wednesday, June 4, 2008 - 9:21 am

This shouldn't be needed as soon as the userspace supports the proper

You set the LOGITECH_RDESC flag here, but it is then never used anywhere.
I guess that your original intent was to check for this flag in
lg_report_fixup(), right?

Thanks,

--
Jiri Kosina
SUSE Labs
--

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Monday, June 9, 2008 - 6:33 am

This is needed to tell generic drivers not to bind these, its' generic

I assumed use of these in the second round (see my previous email) :). Anyway
they are useless now.
--

To: Jiri Slaby <jirislaby@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Wednesday, June 11, 2008 - 10:13 am

Hmm ... but if we make sure that the order in `modules.order' puts all the
specialized drivers before the generic one, the binding should be done
correctly even without blacklist, right?

--
Jiri Kosina
SUSE Labs
--

To: Jiri Kosina <jkosina@...>
Cc: Jiri Slaby <jirislaby@...>, Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>
Date: Wednesday, June 11, 2008 - 2:23 pm

A little off-topic, but is there a module-init-tools repository with
modules.order handling somewhere, or does it (still) only exist as
not-yet-integrated patches?

--
Anssi Hannula
--

To: Jiri Kosina <jkosina@...>
Cc: Jiri Slaby <jirislaby@...>, Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Wednesday, June 11, 2008 - 11:39 am

No. You might have two devices connected. The first correctly triggers
the loading of the generic driver. The second would first load the specialised
driver but the already loaded driver will be faster.

Regards
Oliver

--

To: Oliver Neukum <oliver@...>
Cc: Jiri Kosina <jkosina@...>, Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Wednesday, June 11, 2008 - 2:35 pm

Hm, the problem here is, that report (supported inputs et al.) parsing needs to
be done some time. Since some devices have reports broken too, some of their
reports need to be fixed before parsing. So the parsing is postponed after
*first* driver binds, then it's checked if the coming driver has report_fixup
hook and if yes, it's executed and the device is finally parsed and set up. If
it has not (e.g. generic), it's just parsed and set up.

If you bind the generic driver as the first driver and the particular device
needs report fixing, it never performs the fixup. Actually what I don't know is
how to solve this effectively.
--

To: Jiri Slaby <jirislaby@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jslaby@...>
Date: Wednesday, June 4, 2008 - 8:16 am

Hi Jiri,

is there a reason why this moves only the report descriptor
Logitech-specific quirks, but leaves the input mapping still in
hid-input-quirks.c and doesn't move it into ->input_mapping method too?

Thanks,

--
Jiri Kosina
SUSE Labs
--

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Monday, June 9, 2008 - 6:29 am

Hi!

No, there is no strong reason, I just postponed it to the second round of
changes. I wanted to hear comments first, so I only moved fully only apple
driver (to present how the concept was thought). After things settle down, I'm
going to move the rest of quirks including this one.
--

To: Jiri Slaby <jirislaby@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Monday, June 16, 2008 - 6:15 am

Thanks a lot. Would you please care to do another round of submission,
with the missing assignment fixed in the apple driver, and also with the
->input_mapping added too?

I would like to avoid a situation when we have a part of functionality for
certain devices implemented in generic driver and a part in specialized
driver, if possible.

Thanks a lot,

--
Jiri Kosina
SUSE Labs
--

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jirislaby@...>, Jiri Slaby <jslaby@...>
Date: Friday, May 16, 2008 - 5:49 am

Move ignore quirks from usbhid-quirks into hid-core code. Also don't output
warning when ENODEV is error code in usbhid and try ordinal input in hidp
when that error is returned.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/hid/hid-core.c | 215 +++++++++++++++++++++++++++++++++++++++
drivers/hid/usbhid/hid-core.c | 3 +-
drivers/hid/usbhid/hid-quirks.c | 200 ------------------------------------
net/bluetooth/hidp/core.c | 2 +-
4 files changed, 218 insertions(+), 202 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 4b1b814..fa9d05b 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1222,6 +1222,216 @@ static struct bus_type hid_bus_type = {
.uevent = hid_uevent,
};

+static const struct hid_device_id hid_usb_ignore[] = {
+ { HID_USB_DEVICE(USB_VENDOR_ID_ADS_TECH, USB_DEVICE_ID_ADS_TECH_RADIO_SI470X) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_01) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_10) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_20) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_21) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM)},
+ { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYP...

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jirislaby@...>, Jiri Slaby <jslaby@...>
Date: Friday, May 16, 2008 - 5:49 am

Move them from core code to separate driver.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/hid/Kconfig | 14 ++
drivers/hid/Makefile | 1 +
drivers/hid/hid-apple.c | 466 +++++++++++++++++++++++++++++++++++++++
drivers/hid/hid-core.c | 28 +++
drivers/hid/hid-input-quirks.c | 8 -
drivers/hid/hid-input.c | 219 +------------------
drivers/hid/usbhid/Kconfig | 11 -
drivers/hid/usbhid/hid-quirks.c | 43 ----
include/linux/hid.h | 12 -
net/bluetooth/hidp/core.c | 22 --
10 files changed, 510 insertions(+), 314 deletions(-)
create mode 100644 drivers/hid/hid-apple.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 066e8c0..9a9fd7d 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -78,6 +78,20 @@ config HID_LOGITECH
Support for some Logitech devices which breaks less or more
HID specification.

+config HID_APPLE
+ tristate "Apple"
+ default m
+ depends on (USB_HID || BT_HIDP)
+ ---help---
+ Support for some Apple devices which less or more break
+ HID specification.
+
+ Say Y here if you want support for the special keys (Fn, Numlock) on
+ Apple iBooks, PowerBooks, MacBooks, MacBook Pros and aluminum USB
+ keyboards.
+
+ If unsure, say N.
+
endmenu

endif # HID_SUPPORT
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index cae036b..8a5cbbe 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -9,6 +9,7 @@ hid-$(CONFIG_HID_DEBUG) += hid-debug.o
hid-$(CONFIG_HIDRAW) += hidraw.o

obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
+obj-$(CONFIG_HID_APPLE) += hid-apple.o

obj-$(CONFIG_USB_HID) += usbhid/
obj-$(CONFIG_USB_MOUSE) += usbhid/
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
new file mode 100644
index 0000000..b39d25c
--- /dev/null
+++ b/drivers/hid/hid-apple.c
@@ -0,0 +1,466 @@
+/*
+ * USB HID quirks support for Linux
+ *
+ * Copyright (c) 1999 Andreas Gal
+ * Copyr...

To: Jiri Slaby <jirislaby@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jslaby@...>
Date: Wednesday, June 4, 2008 - 10:13 am

Hi Jiri,

you don't seem to set asc->quirks anywhere, but the rest of the code is
testing this flag. Is something like

asc->quirks = id->driver_data;

missing in the _probe routine?

Or am I just horribly overlooking something?

Thanks,

--
Jiri Kosina
SUSE Labs
--

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Monday, June 9, 2008 - 6:40 am

Blah, good catch! Do you want me to post a patch, or will you fix this on your own?
--

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>, Jiri Slaby <jirislaby@...>
Date: Friday, May 16, 2008 - 5:49 am

Add compat option to hid code to allow loading of all modules on
systems which don't allow autoloading because of old userspace.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
Documentation/feature-removal-schedule.txt | 7 +++++++
drivers/hid/Kconfig | 11 +++++++++++
drivers/hid/Makefile | 4 ++++
drivers/hid/hid-apple.c | 2 ++
drivers/hid/hid-core.c | 12 ++++++++++++
drivers/hid/hid-dummy.c | 13 +++++++++++++
drivers/hid/hid-logitech.c | 2 ++
include/linux/hid.h | 17 +++++++++++++++--
8 files changed, 66 insertions(+), 2 deletions(-)
create mode 100644 drivers/hid/hid-dummy.c

diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 3c35d45..1564e87 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -289,6 +289,13 @@ Who: Glauber Costa <gcosta@redhat.com>

---------------------------

+What: remove HID compat support
+When: 2.6.29
+Why: needed only as a temporary solution until distros fix themselves up
+Who: Jiri Slaby <jirislaby@gmail.com>
+
+---------------------------
+
What: /sys/o2cb symlink
When: January 2010
Why: /sys/fs/o2cb is the proper location for this information - /sys/o2cb
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 9a9fd7d..ba9ca39 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -70,6 +70,17 @@ source "drivers/hid/usbhid/Kconfig"
menu "Special HID drivers"
depends on HID

+config HID_COMPAT
+ bool "Load all HID drivers on hid core load"
+ ---help---
+ Compatible option for older userspace. If you have system without udev
+ support of module loading through aliases and also old
+ module-init-tools which can't handle hid bus, choose Y here. Otherwise
+ say N. If you say N and your userspace is old enough, the only...

To: Jiri Slaby <jirislaby@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, Marcel Holtmann <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Wednesday, June 4, 2008 - 4:55 am

Hi Jiri,

shouldn't we leave this default to 'Y' for quite some time?

Thanks,

--
Jiri Kosina
SUSE Labs
--

To: Jiri Kosina <jkosina@...>
Cc: Dmitry Torokhov <dmitry.torokhov@...>, <linux-input@...>, Marcel Holtmann <marcel@...>, <linux-kernel@...>, <anssi.hannula@...>
Date: Wednesday, June 4, 2008 - 5:00 am

This is unnecessary on most configurations, but requisite on old
userspace. I think, we choose options like this to be yes. Please
alter the patch. Thanks.
--

Previous thread: thinkpad_acpi: fix possible NULL pointer dereference if kstrdup for ec_version_str failed by Jan Lieskovsky on Friday, May 16, 2008 - 5:34 am. (2 messages)

Next thread: [PATCH] Bsdacct: stir up comments around acct_process. by Pavel Emelyanov on Friday, May 16, 2008 - 6:54 am. (2 messages)