Commit 16a334c0 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: introduce usb_to_input_id() to uniformly produce

       struct input_id for USB input devices.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent c27a7482
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
/* /*
* Version Information * Version Information
...@@ -212,10 +213,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ ...@@ -212,10 +213,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
acecad->dev.name = acecad->name; acecad->dev.name = acecad->name;
acecad->dev.phys = acecad->phys; acecad->dev.phys = acecad->phys;
acecad->dev.id.bustype = BUS_USB; usb_to_input_id(dev, &acecad->dev.id);
acecad->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
acecad->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
acecad->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
acecad->dev.dev = &intf->dev; acecad->dev.dev = &intf->dev;
usb_fill_int_urb(acecad->irq, dev, pipe, usb_fill_int_urb(acecad->irq, dev, pipe,
......
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
...@@ -2125,10 +2126,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -2125,10 +2126,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
aiptek->inputdev.absflat[ABS_WHEEL] = 0; aiptek->inputdev.absflat[ABS_WHEEL] = 0;
aiptek->inputdev.name = "Aiptek"; aiptek->inputdev.name = "Aiptek";
aiptek->inputdev.phys = aiptek->features.usbPath; aiptek->inputdev.phys = aiptek->features.usbPath;
aiptek->inputdev.id.bustype = BUS_USB; usb_to_input_id(usbdev, &aiptek->inputdev.id);
aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor);
aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct);
aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice);
aiptek->inputdev.dev = &intf->dev; aiptek->inputdev.dev = &intf->dev;
aiptek->usbdev = usbdev; aiptek->usbdev = usbdev;
......
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
#include <linux/wait.h> #include <linux/wait.h>
/* /*
...@@ -635,11 +636,8 @@ static void ati_remote_input_init(struct ati_remote *ati_remote) ...@@ -635,11 +636,8 @@ static void ati_remote_input_init(struct ati_remote *ati_remote)
idev->name = ati_remote->name; idev->name = ati_remote->name;
idev->phys = ati_remote->phys; idev->phys = ati_remote->phys;
idev->id.bustype = BUS_USB; usb_to_input_id(ati_remote->udev, &idev->id);
idev->id.vendor = le16_to_cpu(ati_remote->udev->descriptor.idVendor); idev->dev = &ati_remote->udev->dev;
idev->id.product = le16_to_cpu(ati_remote->udev->descriptor.idProduct);
idev->id.version = le16_to_cpu(ati_remote->udev->descriptor.bcdDevice);
idev->dev = &(ati_remote->udev->dev);
} }
static int ati_remote_initialize(struct ati_remote *ati_remote) static int ati_remote_initialize(struct ati_remote *ati_remote)
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
#undef DEBUG #undef DEBUG
...@@ -581,10 +582,7 @@ int hidinput_connect(struct hid_device *hid) ...@@ -581,10 +582,7 @@ int hidinput_connect(struct hid_device *hid)
hidinput->input.name = hid->name; hidinput->input.name = hid->name;
hidinput->input.phys = hid->phys; hidinput->input.phys = hid->phys;
hidinput->input.uniq = hid->uniq; hidinput->input.uniq = hid->uniq;
hidinput->input.id.bustype = BUS_USB; usb_to_input_id(dev, &hidinput->input.id);
hidinput->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
hidinput->input.id.product = le16_to_cpu(dev->descriptor.idProduct);
hidinput->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
hidinput->input.dev = &hid->intf->dev; hidinput->input.dev = &hid->intf->dev;
} }
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
/* only an 8 byte buffer necessary for a single packet */ /* only an 8 byte buffer necessary for a single packet */
#define ITM_BUFSIZE 8 #define ITM_BUFSIZE 8
...@@ -184,10 +185,7 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -184,10 +185,7 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
itmtouch->inputdev.name = itmtouch->name; itmtouch->inputdev.name = itmtouch->name;
itmtouch->inputdev.phys = itmtouch->phys; itmtouch->inputdev.phys = itmtouch->phys;
itmtouch->inputdev.id.bustype = BUS_USB; usb_to_input_id(udev, &itmtouch->inputdev.id);
itmtouch->inputdev.id.vendor = udev->descriptor.idVendor;
itmtouch->inputdev.id.product = udev->descriptor.idProduct;
itmtouch->inputdev.id.version = udev->descriptor.bcdDevice;
itmtouch->inputdev.dev = &intf->dev; itmtouch->inputdev.dev = &intf->dev;
if (!strlen(itmtouch->name)) if (!strlen(itmtouch->name))
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
...@@ -167,10 +168,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -167,10 +168,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
kbtab->dev.name = "KB Gear Tablet"; kbtab->dev.name = "KB Gear Tablet";
kbtab->dev.phys = kbtab->phys; kbtab->dev.phys = kbtab->phys;
kbtab->dev.id.bustype = BUS_USB; usb_to_input_id(dev, &kbtab->dev.id);
kbtab->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
kbtab->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
kbtab->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
kbtab->dev.dev = &intf->dev; kbtab->dev.dev = &intf->dev;
kbtab->usbdev = dev; kbtab->usbdev = dev;
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
#define MTOUCHUSB_MIN_XC 0x0 #define MTOUCHUSB_MIN_XC 0x0
#define MTOUCHUSB_MAX_RAW_XC 0x4000 #define MTOUCHUSB_MAX_RAW_XC 0x4000
...@@ -232,10 +233,7 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -232,10 +233,7 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i
mtouch->input.name = mtouch->name; mtouch->input.name = mtouch->name;
mtouch->input.phys = mtouch->phys; mtouch->input.phys = mtouch->phys;
mtouch->input.id.bustype = BUS_USB; usb_to_input_id(udev, &mtouch->input.id);
mtouch->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
mtouch->input.id.product = le16_to_cpu(udev->descriptor.idProduct);
mtouch->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
mtouch->input.dev = &intf->dev; mtouch->input.dev = &intf->dev;
mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
#define POWERMATE_VENDOR 0x077d /* Griffin Technology, Inc. */ #define POWERMATE_VENDOR 0x077d /* Griffin Technology, Inc. */
#define POWERMATE_PRODUCT_NEW 0x0410 /* Griffin PowerMate */ #define POWERMATE_PRODUCT_NEW 0x0410 /* Griffin PowerMate */
...@@ -389,10 +390,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -389,10 +390,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0); pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0);
pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL); pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL);
pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED); pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED);
pm->input.id.bustype = BUS_USB; usb_to_input_id(udev, &pm->input.id);
pm->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
pm->input.id.product = le16_to_cpu(udev->descriptor.idProduct);
pm->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
pm->input.event = powermate_input_event; pm->input.event = powermate_input_event;
pm->input.dev = &intf->dev; pm->input.dev = &intf->dev;
pm->input.phys = pm->phys; pm->input.phys = pm->phys;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define DEBUG #define DEBUG
#endif #endif
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
#define TOUCHKIT_MIN_XC 0x0 #define TOUCHKIT_MIN_XC 0x0
#define TOUCHKIT_MAX_XC 0x07ff #define TOUCHKIT_MAX_XC 0x07ff
...@@ -202,10 +202,7 @@ static int touchkit_probe(struct usb_interface *intf, ...@@ -202,10 +202,7 @@ static int touchkit_probe(struct usb_interface *intf,
touchkit->input.name = touchkit->name; touchkit->input.name = touchkit->name;
touchkit->input.phys = touchkit->phys; touchkit->input.phys = touchkit->phys;
touchkit->input.id.bustype = BUS_USB; usb_to_input_id(udev, &touchkit->input.id);
touchkit->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
touchkit->input.id.product = le16_to_cpu(udev->descriptor.idProduct);
touchkit->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
touchkit->input.dev = &intf->dev; touchkit->input.dev = &intf->dev;
touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
/* /*
* Version Information * Version Information
...@@ -288,10 +289,7 @@ static int usb_kbd_probe(struct usb_interface *iface, ...@@ -288,10 +289,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
kbd->dev.name = kbd->name; kbd->dev.name = kbd->name;
kbd->dev.phys = kbd->phys; kbd->dev.phys = kbd->phys;
kbd->dev.id.bustype = BUS_USB; usb_to_input_id(dev, &kbd->dev.id);
kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
kbd->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
kbd->dev.dev = &iface->dev; kbd->dev.dev = &iface->dev;
if (dev->manufacturer) if (dev->manufacturer)
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
/* /*
* Version Information * Version Information
...@@ -171,10 +172,7 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_ ...@@ -171,10 +172,7 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_
mouse->dev.name = mouse->name; mouse->dev.name = mouse->name;
mouse->dev.phys = mouse->phys; mouse->dev.phys = mouse->phys;
mouse->dev.id.bustype = BUS_USB; usb_to_input_id(dev, &mouse->dev.id);
mouse->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
mouse->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
mouse->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
mouse->dev.dev = &intf->dev; mouse->dev.dev = &intf->dev;
if (dev->manufacturer) if (dev->manufacturer)
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
...@@ -823,10 +824,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -823,10 +824,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
wacom->dev.name = wacom->features->name; wacom->dev.name = wacom->features->name;
wacom->dev.phys = wacom->phys; wacom->dev.phys = wacom->phys;
wacom->dev.id.bustype = BUS_USB; usb_to_input_id(dev, &wacom->dev.id);
wacom->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
wacom->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
wacom->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
wacom->dev.dev = &intf->dev; wacom->dev.dev = &intf->dev;
wacom->usbdev = dev; wacom->usbdev = dev;
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/usb_input.h>
#define DRIVER_VERSION "v0.0.5" #define DRIVER_VERSION "v0.0.5"
#define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>"
...@@ -256,10 +257,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -256,10 +257,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
xpad->udev = udev; xpad->udev = udev;
xpad->dev.id.bustype = BUS_USB; usb_to_input_id(udev, &xpad->dev.id);
xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct);
xpad->dev.id.version = le16_to_cpu(udev->descriptor.bcdDevice);
xpad->dev.dev = &intf->dev; xpad->dev.dev = &intf->dev;
xpad->dev.private = xpad; xpad->dev.private = xpad;
xpad->dev.name = xpad_device[i].name; xpad->dev.name = xpad_device[i].name;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/usb_input.h>
#include "usbvideo.h" #include "usbvideo.h"
...@@ -845,10 +846,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -845,10 +846,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id
cam->input.private = cam; cam->input.private = cam;
cam->input.evbit[0] = BIT(EV_KEY); cam->input.evbit[0] = BIT(EV_KEY);
cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0); cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0);
cam->input.id.bustype = BUS_USB; usb_to_input_id(dev, &cam->input.id);
cam->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
cam->input.id.product = le16_to_cpu(dev->descriptor.idProduct);
cam->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
input_register_device(&cam->input); input_register_device(&cam->input);
usb_make_path(dev, cam->input_physname, 56); usb_make_path(dev, cam->input_physname, 56);
......
#ifndef __USB_INPUT_H
#define __USB_INPUT_H
/*
* Copyright (C) 2005 Dmitry Torokhov
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#include <linux/usb.h>
#include <linux/input.h>
#include <asm/byteorder.h>
static inline void
usb_to_input_id(const struct usb_device *dev, struct input_id *id)
{
id->bustype = BUS_USB;
id->vendor = le16_to_cpu(dev->descriptor.idVendor);
id->product = le16_to_cpu(dev->descriptor.idProduct);
id->version = le16_to_cpu(dev->descriptor.bcdDevice);
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment