From e5199766c278a798e5edb71c7b377af82fecf591 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 24 Oct 2010 18:16:57 +0200 Subject: [PATCH] --- yaml --- r: 215597 b: refs/heads/master c: 0a57274ea026c2b7670683947b6cc08b195148cf h: refs/heads/master i: 215595: 9a596004184ba18c6ac9e00a674b5abb09787c82 v: v3 --- [refs] | 2 +- .../ABI/testing/sysfs-driver-hid-roccat-pyra | 98 -- trunk/Documentation/input/ntrig.txt | 126 -- trunk/MAINTAINERS | 16 - trunk/arch/arm/mach-omap2/clock2420_data.c | 2 +- trunk/arch/arm/mach-omap2/clock2430_data.c | 2 +- trunk/arch/arm/mach-omap2/clock3xxx_data.c | 2 +- trunk/arch/arm/mach-omap2/devices.c | 71 -- trunk/crypto/Kconfig | 21 +- trunk/crypto/cryptd.c | 206 +-- trunk/drivers/crypto/Kconfig | 9 - trunk/drivers/crypto/Makefile | 3 +- trunk/drivers/crypto/amcc/Makefile | 2 +- trunk/drivers/crypto/hifn_795x.c | 3 +- trunk/drivers/crypto/omap-aes.c | 948 -------------- trunk/drivers/crypto/omap-sham.c | 6 +- trunk/drivers/crypto/talitos.c | 29 +- trunk/drivers/hid/Kconfig | 91 +- trunk/drivers/hid/Makefile | 6 - trunk/drivers/hid/hid-3m-pct.c | 127 +- trunk/drivers/hid/hid-a4tech.c | 2 - trunk/drivers/hid/hid-apple.c | 7 +- trunk/drivers/hid/hid-cherry.c | 7 +- trunk/drivers/hid/hid-core.c | 23 +- trunk/drivers/hid/hid-cypress.c | 9 +- trunk/drivers/hid/hid-debug.c | 2 - trunk/drivers/hid/hid-egalax.c | 16 +- trunk/drivers/hid/hid-elecom.c | 7 +- trunk/drivers/hid/hid-ids.h | 23 +- trunk/drivers/hid/hid-input.c | 87 -- trunk/drivers/hid/hid-kye.c | 7 +- trunk/drivers/hid/hid-lg.c | 49 +- trunk/drivers/hid/hid-lg.h | 6 - trunk/drivers/hid/hid-lg2ff.c | 4 +- trunk/drivers/hid/hid-lg4ff.c | 136 -- trunk/drivers/hid/hid-magicmouse.c | 325 +++-- trunk/drivers/hid/hid-microsoft.c | 7 +- trunk/drivers/hid/hid-monterey.c | 7 +- trunk/drivers/hid/hid-ntrig.c | 69 +- trunk/drivers/hid/hid-ortek.c | 7 +- trunk/drivers/hid/hid-petalynx.c | 7 +- trunk/drivers/hid/hid-prodikeys.c | 7 +- trunk/drivers/hid/hid-roccat-pyra.c | 968 --------------- trunk/drivers/hid/hid-roccat-pyra.h | 186 --- trunk/drivers/hid/hid-samsung.c | 20 +- trunk/drivers/hid/hid-sony.c | 56 +- trunk/drivers/hid/hid-stantum.c | 2 - trunk/drivers/hid/hid-sunplus.c | 7 +- trunk/drivers/hid/hid-uclogic.c | 623 ---------- trunk/drivers/hid/hid-waltop.c | 1099 ----------------- trunk/drivers/hid/hid-zydacron.c | 7 +- trunk/drivers/hid/hidraw.c | 14 +- trunk/drivers/hid/usbhid/hid-core.c | 9 +- trunk/drivers/hid/usbhid/hid-quirks.c | 6 +- trunk/drivers/hid/usbhid/hiddev.c | 40 + trunk/drivers/i2c/Kconfig | 3 +- trunk/drivers/i2c/algos/Kconfig | 12 + trunk/include/crypto/cryptd.h | 24 - trunk/include/linux/hid.h | 5 +- trunk/include/linux/hiddev.h | 4 + trunk/include/linux/padata.h | 4 +- 61 files changed, 427 insertions(+), 5246 deletions(-) delete mode 100644 trunk/Documentation/ABI/testing/sysfs-driver-hid-roccat-pyra delete mode 100644 trunk/Documentation/input/ntrig.txt delete mode 100644 trunk/drivers/crypto/omap-aes.c delete mode 100644 trunk/drivers/hid/hid-lg4ff.c delete mode 100644 trunk/drivers/hid/hid-roccat-pyra.c delete mode 100644 trunk/drivers/hid/hid-roccat-pyra.h delete mode 100644 trunk/drivers/hid/hid-uclogic.c delete mode 100644 trunk/drivers/hid/hid-waltop.c diff --git a/[refs] b/[refs] index 6231335215e1..03280049931c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7c024e9534f9edd8d052380a1b40d376c8feb11b +refs/heads/master: 0a57274ea026c2b7670683947b6cc08b195148cf diff --git a/trunk/Documentation/ABI/testing/sysfs-driver-hid-roccat-pyra b/trunk/Documentation/ABI/testing/sysfs-driver-hid-roccat-pyra deleted file mode 100644 index ad1125b02ff4..000000000000 --- a/trunk/Documentation/ABI/testing/sysfs-driver-hid-roccat-pyra +++ /dev/null @@ -1,98 +0,0 @@ -What: /sys/bus/usb/devices/-:./actual_cpi -Date: August 2010 -Contact: Stefan Achatz -Description: It is possible to switch the cpi setting of the mouse with the - press of a button. - When read, this file returns the raw number of the actual cpi - setting reported by the mouse. This number has to be further - processed to receive the real dpi value. - - VALUE DPI - 1 400 - 2 800 - 4 1600 - - This file is readonly. - -What: /sys/bus/usb/devices/-:./actual_profile -Date: August 2010 -Contact: Stefan Achatz -Description: When read, this file returns the number of the actual profile in - range 0-4. - This file is readonly. - -What: /sys/bus/usb/devices/-:./firmware_version -Date: August 2010 -Contact: Stefan Achatz -Description: When read, this file returns the raw integer version number of the - firmware reported by the mouse. Using the integer value eases - further usage in other programs. To receive the real version - number the decimal point has to be shifted 2 positions to the - left. E.g. a returned value of 138 means 1.38 - This file is readonly. - -What: /sys/bus/usb/devices/-:./profile_settings -Date: August 2010 -Contact: Stefan Achatz -Description: The mouse can store 5 profiles which can be switched by the - press of a button. A profile is split in settings and buttons. - profile_settings holds informations like resolution, sensitivity - and light effects. - When written, this file lets one write the respective profile - settings back to the mouse. The data has to be 13 bytes long. - The mouse will reject invalid data. - Which profile to write is determined by the profile number - contained in the data. - This file is writeonly. - -What: /sys/bus/usb/devices/-:./profile[1-5]_settings -Date: August 2010 -Contact: Stefan Achatz -Description: The mouse can store 5 profiles which can be switched by the - press of a button. A profile is split in settings and buttons. - profile_settings holds informations like resolution, sensitivity - and light effects. - When read, these files return the respective profile settings. - The returned data is 13 bytes in size. - This file is readonly. - -What: /sys/bus/usb/devices/-:./profile_buttons -Date: August 2010 -Contact: Stefan Achatz -Description: The mouse can store 5 profiles which can be switched by the - press of a button. A profile is split in settings and buttons. - profile_buttons holds informations about button layout. - When written, this file lets one write the respective profile - buttons back to the mouse. The data has to be 19 bytes long. - The mouse will reject invalid data. - Which profile to write is determined by the profile number - contained in the data. - This file is writeonly. - -What: /sys/bus/usb/devices/-:./profile[1-5]_buttons -Date: August 2010 -Contact: Stefan Achatz -Description: The mouse can store 5 profiles which can be switched by the - press of a button. A profile is split in settings and buttons. - profile_buttons holds informations about button layout. - When read, these files return the respective profile buttons. - The returned data is 19 bytes in size. - This file is readonly. - -What: /sys/bus/usb/devices/-:./startup_profile -Date: August 2010 -Contact: Stefan Achatz -Description: The integer value of this attribute ranges from 0-4. - When read, this attribute returns the number of the profile - that's active when the mouse is powered on. - This file is readonly. - -What: /sys/bus/usb/devices/-:./settings -Date: August 2010 -Contact: Stefan Achatz -Description: When read, this file returns the settings stored in the mouse. - The size of the data is 3 bytes and holds information on the - startup_profile. - When written, this file lets write settings back to the mouse. - The data has to be 3 bytes long. The mouse will reject invalid - data. diff --git a/trunk/Documentation/input/ntrig.txt b/trunk/Documentation/input/ntrig.txt deleted file mode 100644 index be1fd981f73f..000000000000 --- a/trunk/Documentation/input/ntrig.txt +++ /dev/null @@ -1,126 +0,0 @@ -N-Trig touchscreen Driver -------------------------- - Copyright (c) 2008-2010 Rafi Rubin - Copyright (c) 2009-2010 Stephane Chatty - -This driver provides support for N-Trig pen and multi-touch sensors. Single -and multi-touch events are translated to the appropriate protocols for -the hid and input systems. Pen events are sufficiently hid compliant and -are left to the hid core. The driver also provides additional filtering -and utility functions accessible with sysfs and module parameters. - -This driver has been reported to work properly with multiple N-Trig devices -attached. - - -Parameters ----------- - -Note: values set at load time are global and will apply to all applicable -devices. Adjusting parameters with sysfs will override the load time values, -but only for that one device. - -The following parameters are used to configure filters to reduce noise: - -activate_slack number of fingers to ignore before processing events - -activation_height size threshold to activate immediately -activation_width - -min_height size threshold bellow which fingers are ignored -min_width both to decide activation and during activity - -deactivate_slack the number of "no contact" frames to ignore before - propagating the end of activity events - -When the last finger is removed from the device, it sends a number of empty -frames. By holding off on deactivation for a few frames we can tolerate false -erroneous disconnects, where the sensor may mistakenly not detect a finger that -is still present. Thus deactivate_slack addresses problems where a users might -see breaks in lines during drawing, or drop an object during a long drag. - - -Additional sysfs items ----------------------- - -These nodes just provide easy access to the ranges reported by the device. -sensor_logical_height the range for positions reported during activity -sensor_logical_width - -sensor_physical_height internal ranges not used for normal events but -sensor_physical_width useful for tuning - -All N-Trig devices with product id of 1 report events in the ranges of -X: 0-9600 -Y: 0-7200 -However not all of these devices have the same physical dimensions. Most -seem to be 12" sensors (Dell Latitude XT and XT2 and the HP TX2), and -at least one model (Dell Studio 17) has a 17" sensor. The ratio of physical -to logical sizes is used to adjust the size based filter parameters. - - -Filtering ---------- - -With the release of the early multi-touch firmwares it became increasingly -obvious that these sensors were prone to erroneous events. Users reported -seeing both inappropriately dropped contact and ghosts, contacts reported -where no finger was actually touching the screen. - -Deactivation slack helps prevent dropped contact for single touch use, but does -not address the problem of dropping one of more contacts while other contacts -are still active. Drops in the multi-touch context require additional -processing and should be handled in tandem with tacking. - -As observed ghost contacts are similar to actual use of the sensor, but they -seem to have different profiles. Ghost activity typically shows up as small -short lived touches. As such, I assume that the longer the continuous stream -of events the more likely those events are from a real contact, and that the -larger the size of each contact the more likely it is real. Balancing the -goals of preventing ghosts and accepting real events quickly (to minimize -user observable latency), the filter accumulates confidence for incoming -events until it hits thresholds and begins propagating. In the interest in -minimizing stored state as well as the cost of operations to make a decision, -I've kept that decision simple. - -Time is measured in terms of the number of fingers reported, not frames since -the probability of multiple simultaneous ghosts is expected to drop off -dramatically with increasing numbers. Rather than accumulate weight as a -function of size, I just use it as a binary threshold. A sufficiently large -contact immediately overrides the waiting period and leads to activation. - -Setting the activation size thresholds to large values will result in deciding -primarily on activation slack. If you see longer lived ghosts, turning up the -activation slack while reducing the size thresholds may suffice to eliminate -the ghosts while keeping the screen quite responsive to firm taps. - -Contacts continue to be filtered with min_height and min_width even after -the initial activation filter is satisfied. The intent is to provide -a mechanism for filtering out ghosts in the form of an extra finger while -you actually are using the screen. In practice this sort of ghost has -been far less problematic or relatively rare and I've left the defaults -set to 0 for both parameters, effectively turning off that filter. - -I don't know what the optimal values are for these filters. If the defaults -don't work for you, please play with the parameters. If you do find other -values more comfortable, I would appreciate feedback. - -The calibration of these devices does drift over time. If ghosts or contact -dropping worsen and interfere with the normal usage of your device, try -recalibrating it. - - -Calibration ------------ - -The N-Trig windows tools provide calibration and testing routines. Also an -unofficial unsupported set of user space tools including a calibrator is -available at: -http://code.launchpad.net/~rafi-seas/+junk/ntrig_calib - - -Tracking --------- - -As of yet, all tested N-Trig firmwares do not track fingers. When multiple -contacts are active they seem to be sorted primarily by Y position. diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 9bd4422618e9..494e1a07366a 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -4453,15 +4453,6 @@ L: linux-i2c@vger.kernel.org S: Maintained F: drivers/i2c/busses/i2c-pasemi.c -PADATA PARALLEL EXECUTION MECHANISM -M: Steffen Klassert -L: linux-kernel@vger.kernel.org -L: linux-crypto@vger.kernel.org -S: Maintained -F: kernel/padata.c -F: include/linux/padata.h -F: Documentation/padata.txt - PANASONIC LAPTOP ACPI EXTRAS DRIVER M: Harald Welte L: platform-driver-x86@vger.kernel.org @@ -4589,13 +4580,6 @@ L: netdev@vger.kernel.org S: Maintained F: drivers/net/pcnet32.c -PCRYPT PARALLEL CRYPTO ENGINE -M: Steffen Klassert -L: linux-crypto@vger.kernel.org -S: Maintained -F: crypto/pcrypt.c -F: include/crypto/pcrypt.h - PER-TASK DELAY ACCOUNTING M: Balbir Singh S: Maintained diff --git a/trunk/arch/arm/mach-omap2/clock2420_data.c b/trunk/arch/arm/mach-omap2/clock2420_data.c index 5f2066a6ba74..37d65d62ed8f 100644 --- a/trunk/arch/arm/mach-omap2/clock2420_data.c +++ b/trunk/arch/arm/mach-omap2/clock2420_data.c @@ -1838,7 +1838,7 @@ static struct omap_clk omap2420_clks[] = { CLK(NULL, "des_ick", &des_ick, CK_242X), CLK("omap-sham", "ick", &sha_ick, CK_242X), CLK("omap_rng", "ick", &rng_ick, CK_242X), - CLK("omap-aes", "ick", &aes_ick, CK_242X), + CLK(NULL, "aes_ick", &aes_ick, CK_242X), CLK(NULL, "pka_ick", &pka_ick, CK_242X), CLK(NULL, "usb_fck", &usb_fck, CK_242X), CLK("musb_hdrc", "fck", &osc_ck, CK_242X), diff --git a/trunk/arch/arm/mach-omap2/clock2430_data.c b/trunk/arch/arm/mach-omap2/clock2430_data.c index 701a1716019e..b33118fb6a87 100644 --- a/trunk/arch/arm/mach-omap2/clock2430_data.c +++ b/trunk/arch/arm/mach-omap2/clock2430_data.c @@ -1926,7 +1926,7 @@ static struct omap_clk omap2430_clks[] = { CLK(NULL, "des_ick", &des_ick, CK_243X), CLK("omap-sham", "ick", &sha_ick, CK_243X), CLK("omap_rng", "ick", &rng_ick, CK_243X), - CLK("omap-aes", "ick", &aes_ick, CK_243X), + CLK(NULL, "aes_ick", &aes_ick, CK_243X), CLK(NULL, "pka_ick", &pka_ick, CK_243X), CLK(NULL, "usb_fck", &usb_fck, CK_243X), CLK("musb_hdrc", "ick", &usbhs_ick, CK_243X), diff --git a/trunk/arch/arm/mach-omap2/clock3xxx_data.c b/trunk/arch/arm/mach-omap2/clock3xxx_data.c index c73906d17458..dfdce2d82779 100644 --- a/trunk/arch/arm/mach-omap2/clock3xxx_data.c +++ b/trunk/arch/arm/mach-omap2/clock3xxx_data.c @@ -3288,7 +3288,7 @@ static struct omap_clk omap3xxx_clks[] = { CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2 | CK_AM35XX), CLK("mmci-omap-hs.2", "ick", &mmchs3_ick, CK_3430ES2 | CK_AM35XX), CLK(NULL, "icr_ick", &icr_ick, CK_343X), - CLK("omap-aes", "ick", &aes2_ick, CK_343X), + CLK(NULL, "aes2_ick", &aes2_ick, CK_343X), CLK("omap-sham", "ick", &sha12_ick, CK_343X), CLK(NULL, "des2_ick", &des2_ick, CK_343X), CLK("mmci-omap-hs.1", "ick", &mmchs2_ick, CK_3XXX), diff --git a/trunk/arch/arm/mach-omap2/devices.c b/trunk/arch/arm/mach-omap2/devices.c index b27e7cbb3f29..2dbb265bedd4 100644 --- a/trunk/arch/arm/mach-omap2/devices.c +++ b/trunk/arch/arm/mach-omap2/devices.c @@ -498,76 +498,6 @@ static void omap_init_sham(void) static inline void omap_init_sham(void) { } #endif -#if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE) - -#ifdef CONFIG_ARCH_OMAP24XX -static struct resource omap2_aes_resources[] = { - { - .start = OMAP24XX_SEC_AES_BASE, - .end = OMAP24XX_SEC_AES_BASE + 0x4C, - .flags = IORESOURCE_MEM, - }, - { - .start = OMAP24XX_DMA_AES_TX, - .flags = IORESOURCE_DMA, - }, - { - .start = OMAP24XX_DMA_AES_RX, - .flags = IORESOURCE_DMA, - } -}; -static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources); -#else -#define omap2_aes_resources NULL -#define omap2_aes_resources_sz 0 -#endif - -#ifdef CONFIG_ARCH_OMAP34XX -static struct resource omap3_aes_resources[] = { - { - .start = OMAP34XX_SEC_AES_BASE, - .end = OMAP34XX_SEC_AES_BASE + 0x4C, - .flags = IORESOURCE_MEM, - }, - { - .start = OMAP34XX_DMA_AES2_TX, - .flags = IORESOURCE_DMA, - }, - { - .start = OMAP34XX_DMA_AES2_RX, - .flags = IORESOURCE_DMA, - } -}; -static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources); -#else -#define omap3_aes_resources NULL -#define omap3_aes_resources_sz 0 -#endif - -static struct platform_device aes_device = { - .name = "omap-aes", - .id = -1, -}; - -static void omap_init_aes(void) -{ - if (cpu_is_omap24xx()) { - aes_device.resource = omap2_aes_resources; - aes_device.num_resources = omap2_aes_resources_sz; - } else if (cpu_is_omap34xx()) { - aes_device.resource = omap3_aes_resources; - aes_device.num_resources = omap3_aes_resources_sz; - } else { - pr_err("%s: platform not supported\n", __func__); - return; - } - platform_device_register(&aes_device); -} - -#else -static inline void omap_init_aes(void) { } -#endif - /*-------------------------------------------------------------------------*/ #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) @@ -924,7 +854,6 @@ static int __init omap2_init_devices(void) omap_hdq_init(); omap_init_sti(); omap_init_sham(); - omap_init_aes(); omap_init_vout(); return 0; diff --git a/trunk/crypto/Kconfig b/trunk/crypto/Kconfig index e4bac29a32e7..e573077f1672 100644 --- a/trunk/crypto/Kconfig +++ b/trunk/crypto/Kconfig @@ -23,12 +23,13 @@ comment "Crypto core or helper" config CRYPTO_FIPS bool "FIPS 200 compliance" - depends on CRYPTO_ANSI_CPRNG && !CRYPTO_MANAGER_DISABLE_TESTS + depends on CRYPTO_ANSI_CPRNG help This options enables the fips boot option which is required if you want to system to operate in a FIPS 200 certification. You should say no unless you know what - this is. + this is. Note that CRYPTO_ANSI_CPRNG is required if this + option is selected config CRYPTO_ALGAPI tristate @@ -364,7 +365,7 @@ config CRYPTO_RMD128 RIPEMD-160 should be used. Developed by Hans Dobbertin, Antoon Bosselaers and Bart Preneel. - See + See config CRYPTO_RMD160 tristate "RIPEMD-160 digest algorithm" @@ -381,7 +382,7 @@ config CRYPTO_RMD160 against RIPEMD-160. Developed by Hans Dobbertin, Antoon Bosselaers and Bart Preneel. - See + See config CRYPTO_RMD256 tristate "RIPEMD-256 digest algorithm" @@ -393,7 +394,7 @@ config CRYPTO_RMD256 (than RIPEMD-128). Developed by Hans Dobbertin, Antoon Bosselaers and Bart Preneel. - See + See config CRYPTO_RMD320 tristate "RIPEMD-320 digest algorithm" @@ -405,7 +406,7 @@ config CRYPTO_RMD320 (than RIPEMD-160). Developed by Hans Dobbertin, Antoon Bosselaers and Bart Preneel. - See + See config CRYPTO_SHA1 tristate "SHA1 digest algorithm" @@ -460,7 +461,7 @@ config CRYPTO_WP512 Whirlpool will be part of the ISO/IEC 10118-3:2003(E) standard See also: - + config CRYPTO_GHASH_CLMUL_NI_INTEL tristate "GHASH digest algorithm (CLMUL-NI accelerated)" @@ -578,8 +579,8 @@ config CRYPTO_ANUBIS in the NESSIE competition. See also: - - + + config CRYPTO_ARC4 tristate "ARC4 cipher algorithm" @@ -658,7 +659,7 @@ config CRYPTO_KHAZAD on 32-bit processors. Khazad uses an 128 bit key size. See also: - + config CRYPTO_SALSA20 tristate "Salsa20 stream cipher algorithm (EXPERIMENTAL)" diff --git a/trunk/crypto/cryptd.c b/trunk/crypto/cryptd.c index e46d21ae26bc..ef71318976c7 100644 --- a/trunk/crypto/cryptd.c +++ b/trunk/crypto/cryptd.c @@ -3,13 +3,6 @@ * * Copyright (c) 2006 Herbert Xu * - * Added AEAD support to cryptd. - * Authors: Tadeusz Struk (tadeusz.struk@intel.com) - * Adrian Hoban - * Gabriele Paoloni - * Aidan O'Mahony (aidan.o.mahony@intel.com) - * Copyright (c) 2010, Intel Corporation. - * * 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) @@ -19,7 +12,6 @@ #include #include -#include #include #include #include @@ -52,11 +44,6 @@ struct hashd_instance_ctx { struct cryptd_queue *queue; }; -struct aead_instance_ctx { - struct crypto_aead_spawn aead_spawn; - struct cryptd_queue *queue; -}; - struct cryptd_blkcipher_ctx { struct crypto_blkcipher *child; }; @@ -74,14 +61,6 @@ struct cryptd_hash_request_ctx { struct shash_desc desc; }; -struct cryptd_aead_ctx { - struct crypto_aead *child; -}; - -struct cryptd_aead_request_ctx { - crypto_completion_t complete; -}; - static void cryptd_queue_worker(struct work_struct *work); static int cryptd_init_queue(struct cryptd_queue *queue, @@ -622,144 +601,6 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, return err; } -static void cryptd_aead_crypt(struct aead_request *req, - struct crypto_aead *child, - int err, - int (*crypt)(struct aead_request *req)) -{ - struct cryptd_aead_request_ctx *rctx; - rctx = aead_request_ctx(req); - - if (unlikely(err == -EINPROGRESS)) - goto out; - aead_request_set_tfm(req, child); - err = crypt( req ); - req->base.complete = rctx->complete; -out: - local_bh_disable(); - rctx->complete(&req->base, err); - local_bh_enable(); -} - -static void cryptd_aead_encrypt(struct crypto_async_request *areq, int err) -{ - struct cryptd_aead_ctx *ctx = crypto_tfm_ctx(areq->tfm); - struct crypto_aead *child = ctx->child; - struct aead_request *req; - - req = container_of(areq, struct aead_request, base); - cryptd_aead_crypt(req, child, err, crypto_aead_crt(child)->encrypt); -} - -static void cryptd_aead_decrypt(struct crypto_async_request *areq, int err) -{ - struct cryptd_aead_ctx *ctx = crypto_tfm_ctx(areq->tfm); - struct crypto_aead *child = ctx->child; - struct aead_request *req; - - req = container_of(areq, struct aead_request, base); - cryptd_aead_crypt(req, child, err, crypto_aead_crt(child)->decrypt); -} - -static int cryptd_aead_enqueue(struct aead_request *req, - crypto_completion_t complete) -{ - struct cryptd_aead_request_ctx *rctx = aead_request_ctx(req); - struct crypto_aead *tfm = crypto_aead_reqtfm(req); - struct cryptd_queue *queue = cryptd_get_queue(crypto_aead_tfm(tfm)); - - rctx->complete = req->base.complete; - req->base.complete = complete; - return cryptd_enqueue_request(queue, &req->base); -} - -static int cryptd_aead_encrypt_enqueue(struct aead_request *req) -{ - return cryptd_aead_enqueue(req, cryptd_aead_encrypt ); -} - -static int cryptd_aead_decrypt_enqueue(struct aead_request *req) -{ - return cryptd_aead_enqueue(req, cryptd_aead_decrypt ); -} - -static int cryptd_aead_init_tfm(struct crypto_tfm *tfm) -{ - struct crypto_instance *inst = crypto_tfm_alg_instance(tfm); - struct aead_instance_ctx *ictx = crypto_instance_ctx(inst); - struct crypto_aead_spawn *spawn = &ictx->aead_spawn; - struct cryptd_aead_ctx *ctx = crypto_tfm_ctx(tfm); - struct crypto_aead *cipher; - - cipher = crypto_spawn_aead(spawn); - if (IS_ERR(cipher)) - return PTR_ERR(cipher); - - crypto_aead_set_flags(cipher, CRYPTO_TFM_REQ_MAY_SLEEP); - ctx->child = cipher; - tfm->crt_aead.reqsize = sizeof(struct cryptd_aead_request_ctx); - return 0; -} - -static void cryptd_aead_exit_tfm(struct crypto_tfm *tfm) -{ - struct cryptd_aead_ctx *ctx = crypto_tfm_ctx(tfm); - crypto_free_aead(ctx->child); -} - -static int cryptd_create_aead(struct crypto_template *tmpl, - struct rtattr **tb, - struct cryptd_queue *queue) -{ - struct aead_instance_ctx *ctx; - struct crypto_instance *inst; - struct crypto_alg *alg; - int err; - - alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_AEAD, - CRYPTO_ALG_TYPE_MASK); - if (IS_ERR(alg)) - return PTR_ERR(alg); - - inst = cryptd_alloc_instance(alg, 0, sizeof(*ctx)); - err = PTR_ERR(inst); - if (IS_ERR(inst)) - goto out_put_alg; - - ctx = crypto_instance_ctx(inst); - ctx->queue = queue; - - err = crypto_init_spawn(&ctx->aead_spawn.base, alg, inst, - CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC); - if (err) - goto out_free_inst; - - inst->alg.cra_flags = CRYPTO_ALG_TYPE_AEAD | CRYPTO_ALG_ASYNC; - inst->alg.cra_type = alg->cra_type; - inst->alg.cra_ctxsize = sizeof(struct cryptd_aead_ctx); - inst->alg.cra_init = cryptd_aead_init_tfm; - inst->alg.cra_exit = cryptd_aead_exit_tfm; - inst->alg.cra_aead.setkey = alg->cra_aead.setkey; - inst->alg.cra_aead.setauthsize = alg->cra_aead.setauthsize; - inst->alg.cra_aead.geniv = alg->cra_aead.geniv; - inst->alg.cra_aead.ivsize = alg->cra_aead.ivsize; - inst->alg.cra_aead.maxauthsize = alg->cra_aead.maxauthsize; - inst->alg.cra_aead.encrypt = cryptd_aead_encrypt_enqueue; - inst->alg.cra_aead.decrypt = cryptd_aead_decrypt_enqueue; - inst->alg.cra_aead.givencrypt = alg->cra_aead.givencrypt; - inst->alg.cra_aead.givdecrypt = alg->cra_aead.givdecrypt; - - err = crypto_register_instance(tmpl, inst); - if (err) { - crypto_drop_spawn(&ctx->aead_spawn.base); -out_free_inst: - kfree(inst); - } -out_put_alg: - crypto_mod_put(alg); - return err; -} - static struct cryptd_queue queue; static int cryptd_create(struct crypto_template *tmpl, struct rtattr **tb) @@ -775,8 +616,6 @@ static int cryptd_create(struct crypto_template *tmpl, struct rtattr **tb) return cryptd_create_blkcipher(tmpl, tb, &queue); case CRYPTO_ALG_TYPE_DIGEST: return cryptd_create_hash(tmpl, tb, &queue); - case CRYPTO_ALG_TYPE_AEAD: - return cryptd_create_aead(tmpl, tb, &queue); } return -EINVAL; @@ -786,21 +625,16 @@ static void cryptd_free(struct crypto_instance *inst) { struct cryptd_instance_ctx *ctx = crypto_instance_ctx(inst); struct hashd_instance_ctx *hctx = crypto_instance_ctx(inst); - struct aead_instance_ctx *aead_ctx = crypto_instance_ctx(inst); switch (inst->alg.cra_flags & CRYPTO_ALG_TYPE_MASK) { case CRYPTO_ALG_TYPE_AHASH: crypto_drop_shash(&hctx->spawn); kfree(ahash_instance(inst)); return; - case CRYPTO_ALG_TYPE_AEAD: - crypto_drop_spawn(&aead_ctx->aead_spawn.base); - kfree(inst); - return; - default: - crypto_drop_spawn(&ctx->spawn); - kfree(inst); } + + crypto_drop_spawn(&ctx->spawn); + kfree(inst); } static struct crypto_template cryptd_tmpl = { @@ -890,40 +724,6 @@ void cryptd_free_ahash(struct cryptd_ahash *tfm) } EXPORT_SYMBOL_GPL(cryptd_free_ahash); -struct cryptd_aead *cryptd_alloc_aead(const char *alg_name, - u32 type, u32 mask) -{ - char cryptd_alg_name[CRYPTO_MAX_ALG_NAME]; - struct crypto_aead *tfm; - - if (snprintf(cryptd_alg_name, CRYPTO_MAX_ALG_NAME, - "cryptd(%s)", alg_name) >= CRYPTO_MAX_ALG_NAME) - return ERR_PTR(-EINVAL); - tfm = crypto_alloc_aead(cryptd_alg_name, type, mask); - if (IS_ERR(tfm)) - return ERR_CAST(tfm); - if (tfm->base.__crt_alg->cra_module != THIS_MODULE) { - crypto_free_aead(tfm); - return ERR_PTR(-EINVAL); - } - return __cryptd_aead_cast(tfm); -} -EXPORT_SYMBOL_GPL(cryptd_alloc_aead); - -struct crypto_aead *cryptd_aead_child(struct cryptd_aead *tfm) -{ - struct cryptd_aead_ctx *ctx; - ctx = crypto_aead_ctx(&tfm->base); - return ctx->child; -} -EXPORT_SYMBOL_GPL(cryptd_aead_child); - -void cryptd_free_aead(struct cryptd_aead *tfm) -{ - crypto_free_aead(&tfm->base); -} -EXPORT_SYMBOL_GPL(cryptd_free_aead); - static int __init cryptd_init(void) { int err; diff --git a/trunk/drivers/crypto/Kconfig b/trunk/drivers/crypto/Kconfig index eab2cf7a0269..ea0b3863ad0f 100644 --- a/trunk/drivers/crypto/Kconfig +++ b/trunk/drivers/crypto/Kconfig @@ -172,7 +172,6 @@ config CRYPTO_DEV_MV_CESA config CRYPTO_DEV_NIAGARA2 tristate "Niagara2 Stream Processing Unit driver" - select CRYPTO_DES select CRYPTO_ALGAPI depends on SPARC64 help @@ -244,12 +243,4 @@ config CRYPTO_DEV_OMAP_SHAM OMAP processors have SHA1/MD5 hw accelerator. Select this if you want to use the OMAP module for SHA1/MD5 algorithms. -config CRYPTO_DEV_OMAP_AES - tristate "Support for OMAP AES hw engine" - depends on ARCH_OMAP2 || ARCH_OMAP3 - select CRYPTO_AES - help - OMAP processors have AES module accelerator. Select this if you - want to use the OMAP module for AES algorithms. - endif # CRYPTO_HW diff --git a/trunk/drivers/crypto/Makefile b/trunk/drivers/crypto/Makefile index 256697330a41..6dbbe00c4524 100644 --- a/trunk/drivers/crypto/Makefile +++ b/trunk/drivers/crypto/Makefile @@ -2,12 +2,11 @@ obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o obj-$(CONFIG_CRYPTO_DEV_GEODE) += geode-aes.o obj-$(CONFIG_CRYPTO_DEV_NIAGARA2) += n2_crypto.o -n2_crypto-y := n2_core.o n2_asm.o +n2_crypto-objs := n2_core.o n2_asm.o obj-$(CONFIG_CRYPTO_DEV_HIFN_795X) += hifn_795x.o obj-$(CONFIG_CRYPTO_DEV_MV_CESA) += mv_cesa.o obj-$(CONFIG_CRYPTO_DEV_TALITOS) += talitos.o obj-$(CONFIG_CRYPTO_DEV_IXP4XX) += ixp4xx_crypto.o obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += amcc/ obj-$(CONFIG_CRYPTO_DEV_OMAP_SHAM) += omap-sham.o -obj-$(CONFIG_CRYPTO_DEV_OMAP_AES) += omap-aes.o diff --git a/trunk/drivers/crypto/amcc/Makefile b/trunk/drivers/crypto/amcc/Makefile index 5c0c62b65d69..aa376e8d5ed5 100644 --- a/trunk/drivers/crypto/amcc/Makefile +++ b/trunk/drivers/crypto/amcc/Makefile @@ -1,2 +1,2 @@ obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += crypto4xx.o -crypto4xx-y := crypto4xx_core.o crypto4xx_alg.o crypto4xx_sa.o +crypto4xx-objs := crypto4xx_core.o crypto4xx_alg.o crypto4xx_sa.o diff --git a/trunk/drivers/crypto/hifn_795x.c b/trunk/drivers/crypto/hifn_795x.c index 0eac3da566ba..e449ac5627a5 100644 --- a/trunk/drivers/crypto/hifn_795x.c +++ b/trunk/drivers/crypto/hifn_795x.c @@ -2700,7 +2700,8 @@ static void __devexit hifn_remove(struct pci_dev *pdev) dev = pci_get_drvdata(pdev); if (dev) { - cancel_delayed_work_sync(&dev->work); + cancel_delayed_work(&dev->work); + flush_scheduled_work(); hifn_unregister_rng(dev); hifn_unregister_alg(dev); diff --git a/trunk/drivers/crypto/omap-aes.c b/trunk/drivers/crypto/omap-aes.c deleted file mode 100644 index 799ca517c121..000000000000 --- a/trunk/drivers/crypto/omap-aes.c +++ /dev/null @@ -1,948 +0,0 @@ -/* - * Cryptographic API. - * - * Support for OMAP AES HW acceleration. - * - * Copyright (c) 2010 Nokia Corporation - * Author: Dmitry Kasatkin - * - * 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. - * - */ - -#define pr_fmt(fmt) "%s: " fmt, __func__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* OMAP TRM gives bitfields as start:end, where start is the higher bit - number. For example 7:0 */ -#define FLD_MASK(start, end) (((1 << ((start) - (end) + 1)) - 1) << (end)) -#define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end)) - -#define AES_REG_KEY(x) (0x1C - ((x ^ 0x01) * 0x04)) -#define AES_REG_IV(x) (0x20 + ((x) * 0x04)) - -#define AES_REG_CTRL 0x30 -#define AES_REG_CTRL_CTR_WIDTH (1 << 7) -#define AES_REG_CTRL_CTR (1 << 6) -#define AES_REG_CTRL_CBC (1 << 5) -#define AES_REG_CTRL_KEY_SIZE (3 << 3) -#define AES_REG_CTRL_DIRECTION (1 << 2) -#define AES_REG_CTRL_INPUT_READY (1 << 1) -#define AES_REG_CTRL_OUTPUT_READY (1 << 0) - -#define AES_REG_DATA 0x34 -#define AES_REG_DATA_N(x) (0x34 + ((x) * 0x04)) - -#define AES_REG_REV 0x44 -#define AES_REG_REV_MAJOR 0xF0 -#define AES_REG_REV_MINOR 0x0F - -#define AES_REG_MASK 0x48 -#define AES_REG_MASK_SIDLE (1 << 6) -#define AES_REG_MASK_START (1 << 5) -#define AES_REG_MASK_DMA_OUT_EN (1 << 3) -#define AES_REG_MASK_DMA_IN_EN (1 << 2) -#define AES_REG_MASK_SOFTRESET (1 << 1) -#define AES_REG_AUTOIDLE (1 << 0) - -#define AES_REG_SYSSTATUS 0x4C -#define AES_REG_SYSSTATUS_RESETDONE (1 << 0) - -#define DEFAULT_TIMEOUT (5*HZ) - -#define FLAGS_MODE_MASK 0x000f -#define FLAGS_ENCRYPT BIT(0) -#define FLAGS_CBC BIT(1) -#define FLAGS_GIV BIT(2) - -#define FLAGS_NEW_KEY BIT(4) -#define FLAGS_NEW_IV BIT(5) -#define FLAGS_INIT BIT(6) -#define FLAGS_FAST BIT(7) -#define FLAGS_BUSY 8 - -struct omap_aes_ctx { - struct omap_aes_dev *dd; - - int keylen; - u32 key[AES_KEYSIZE_256 / sizeof(u32)]; - unsigned long flags; -}; - -struct omap_aes_reqctx { - unsigned long mode; -}; - -#define OMAP_AES_QUEUE_LENGTH 1 -#define OMAP_AES_CACHE_SIZE 0 - -struct omap_aes_dev { - struct list_head list; - unsigned long phys_base; - void __iomem *io_base; - struct clk *iclk; - struct omap_aes_ctx *ctx; - struct device *dev; - unsigned long flags; - - u32 *iv; - u32 ctrl; - - spinlock_t lock; - struct crypto_queue queue; - - struct tasklet_struct task; - - struct ablkcipher_request *req; - size_t total; - struct scatterlist *in_sg; - size_t in_offset; - struct scatterlist *out_sg; - size_t out_offset; - - size_t buflen; - void *buf_in; - size_t dma_size; - int dma_in; - int dma_lch_in; - dma_addr_t dma_addr_in; - void *buf_out; - int dma_out; - int dma_lch_out; - dma_addr_t dma_addr_out; -}; - -/* keep registered devices data here */ -static LIST_HEAD(dev_list); -static DEFINE_SPINLOCK(list_lock); - -static inline u32 omap_aes_read(struct omap_aes_dev *dd, u32 offset) -{ - return __raw_readl(dd->io_base + offset); -} - -static inline void omap_aes_write(struct omap_aes_dev *dd, u32 offset, - u32 value) -{ - __raw_writel(value, dd->io_base + offset); -} - -static inline void omap_aes_write_mask(struct omap_aes_dev *dd, u32 offset, - u32 value, u32 mask) -{ - u32 val; - - val = omap_aes_read(dd, offset); - val &= ~mask; - val |= value; - omap_aes_write(dd, offset, val); -} - -static void omap_aes_write_n(struct omap_aes_dev *dd, u32 offset, - u32 *value, int count) -{ - for (; count--; value++, offset += 4) - omap_aes_write(dd, offset, *value); -} - -static int omap_aes_wait(struct omap_aes_dev *dd, u32 offset, u32 bit) -{ - unsigned long timeout = jiffies + DEFAULT_TIMEOUT; - - while (!(omap_aes_read(dd, offset) & bit)) { - if (time_is_before_jiffies(timeout)) { - dev_err(dd->dev, "omap-aes timeout\n"); - return -ETIMEDOUT; - } - } - return 0; -} - -static int omap_aes_hw_init(struct omap_aes_dev *dd) -{ - int err = 0; - - clk_enable(dd->iclk); - if (!(dd->flags & FLAGS_INIT)) { - /* is it necessary to reset before every operation? */ - omap_aes_write_mask(dd, AES_REG_MASK, AES_REG_MASK_SOFTRESET, - AES_REG_MASK_SOFTRESET); - /* - * prevent OCP bus error (SRESP) in case an access to the module - * is performed while the module is coming out of soft reset - */ - __asm__ __volatile__("nop"); - __asm__ __volatile__("nop"); - - err = omap_aes_wait(dd, AES_REG_SYSSTATUS, - AES_REG_SYSSTATUS_RESETDONE); - if (!err) - dd->flags |= FLAGS_INIT; - } - - return err; -} - -static void omap_aes_hw_cleanup(struct omap_aes_dev *dd) -{ - clk_disable(dd->iclk); -} - -static void omap_aes_write_ctrl(struct omap_aes_dev *dd) -{ - unsigned int key32; - int i; - u32 val, mask; - - val = FLD_VAL(((dd->ctx->keylen >> 3) - 1), 4, 3); - if (dd->flags & FLAGS_CBC) - val |= AES_REG_CTRL_CBC; - if (dd->flags & FLAGS_ENCRYPT) - val |= AES_REG_CTRL_DIRECTION; - - if (dd->ctrl == val && !(dd->flags & FLAGS_NEW_IV) && - !(dd->ctx->flags & FLAGS_NEW_KEY)) - goto out; - - /* only need to write control registers for new settings */ - - dd->ctrl = val; - - val = 0; - if (dd->dma_lch_out >= 0) - val |= AES_REG_MASK_DMA_OUT_EN; - if (dd->dma_lch_in >= 0) - val |= AES_REG_MASK_DMA_IN_EN; - - mask = AES_REG_MASK_DMA_IN_EN | AES_REG_MASK_DMA_OUT_EN; - - omap_aes_write_mask(dd, AES_REG_MASK, val, mask); - - pr_debug("Set key\n"); - key32 = dd->ctx->keylen / sizeof(u32); - /* set a key */ - for (i = 0; i < key32; i++) { - omap_aes_write(dd, AES_REG_KEY(i), - __le32_to_cpu(dd->ctx->key[i])); - } - dd->ctx->flags &= ~FLAGS_NEW_KEY; - - if (dd->flags & FLAGS_NEW_IV) { - pr_debug("Set IV\n"); - omap_aes_write_n(dd, AES_REG_IV(0), dd->iv, 4); - dd->flags &= ~FLAGS_NEW_IV; - } - - mask = AES_REG_CTRL_CBC | AES_REG_CTRL_DIRECTION | - AES_REG_CTRL_KEY_SIZE; - - omap_aes_write_mask(dd, AES_REG_CTRL, dd->ctrl, mask); - -out: - /* start DMA or disable idle mode */ - omap_aes_write_mask(dd, AES_REG_MASK, AES_REG_MASK_START, - AES_REG_MASK_START); -} - -static struct omap_aes_dev *omap_aes_find_dev(struct omap_aes_ctx *ctx) -{ - struct omap_aes_dev *dd = NULL, *tmp; - - spin_lock_bh(&list_lock); - if (!ctx->dd) { - list_for_each_entry(tmp, &dev_list, list) { - /* FIXME: take fist available aes core */ - dd = tmp; - break; - } - ctx->dd = dd; - } else { - /* already found before */ - dd = ctx->dd; - } - spin_unlock_bh(&list_lock); - - return dd; -} - -static void omap_aes_dma_callback(int lch, u16 ch_status, void *data) -{ - struct omap_aes_dev *dd = data; - - if (lch == dd->dma_lch_out) - tasklet_schedule(&dd->task); -} - -static int omap_aes_dma_init(struct omap_aes_dev *dd) -{ - int err = -ENOMEM; - - dd->dma_lch_out = -1; - dd->dma_lch_in = -1; - - dd->buf_in = (void *)__get_free_pages(GFP_KERNEL, OMAP_AES_CACHE_SIZE); - dd->buf_out = (void *)__get_free_pages(GFP_KERNEL, OMAP_AES_CACHE_SIZE); - dd->buflen = PAGE_SIZE << OMAP_AES_CACHE_SIZE; - dd->buflen &= ~(AES_BLOCK_SIZE - 1); - - if (!dd->buf_in || !dd->buf_out) { - dev_err(dd->dev, "unable to alloc pages.\n"); - goto err_alloc; - } - - /* MAP here */ - dd->dma_addr_in = dma_map_single(dd->dev, dd->buf_in, dd->buflen, - DMA_TO_DEVICE); - if (dma_mapping_error(dd->dev, dd->dma_addr_in)) { - dev_err(dd->dev, "dma %d bytes error\n", dd->buflen); - err = -EINVAL; - goto err_map_in; - } - - dd->dma_addr_out = dma_map_single(dd->dev, dd->buf_out, dd->buflen, - DMA_FROM_DEVICE); - if (dma_mapping_error(dd->dev, dd->dma_addr_out)) { - dev_err(dd->dev, "dma %d bytes error\n", dd->buflen); - err = -EINVAL; - goto err_map_out; - } - - err = omap_request_dma(dd->dma_in, "omap-aes-rx", - omap_aes_dma_callback, dd, &dd->dma_lch_in); - if (err) { - dev_err(dd->dev, "Unable to request DMA channel\n"); - goto err_dma_in; - } - err = omap_request_dma(dd->dma_out, "omap-aes-tx", - omap_aes_dma_callback, dd, &dd->dma_lch_out); - if (err) { - dev_err(dd->dev, "Unable to request DMA channel\n"); - goto err_dma_out; - } - - omap_set_dma_dest_params(dd->dma_lch_in, 0, OMAP_DMA_AMODE_CONSTANT, - dd->phys_base + AES_REG_DATA, 0, 4); - - omap_set_dma_dest_burst_mode(dd->dma_lch_in, OMAP_DMA_DATA_BURST_4); - omap_set_dma_src_burst_mode(dd->dma_lch_in, OMAP_DMA_DATA_BURST_4); - - omap_set_dma_src_params(dd->dma_lch_out, 0, OMAP_DMA_AMODE_CONSTANT, - dd->phys_base + AES_REG_DATA, 0, 4); - - omap_set_dma_src_burst_mode(dd->dma_lch_out, OMAP_DMA_DATA_BURST_4); - omap_set_dma_dest_burst_mode(dd->dma_lch_out, OMAP_DMA_DATA_BURST_4); - - return 0; - -err_dma_out: - omap_free_dma(dd->dma_lch_in); -err_dma_in: - dma_unmap_single(dd->dev, dd->dma_addr_out, dd->buflen, - DMA_FROM_DEVICE); -err_map_out: - dma_unmap_single(dd->dev, dd->dma_addr_in, dd->buflen, DMA_TO_DEVICE); -err_map_in: - free_pages((unsigned long)dd->buf_out, OMAP_AES_CACHE_SIZE); - free_pages((unsigned long)dd->buf_in, OMAP_AES_CACHE_SIZE); -err_alloc: - if (err) - pr_err("error: %d\n", err); - return err; -} - -static void omap_aes_dma_cleanup(struct omap_aes_dev *dd) -{ - omap_free_dma(dd->dma_lch_out); - omap_free_dma(dd->dma_lch_in); - dma_unmap_single(dd->dev, dd->dma_addr_out, dd->buflen, - DMA_FROM_DEVICE); - dma_unmap_single(dd->dev, dd->dma_addr_in, dd->buflen, DMA_TO_DEVICE); - free_pages((unsigned long)dd->buf_out, OMAP_AES_CACHE_SIZE); - free_pages((unsigned long)dd->buf_in, OMAP_AES_CACHE_SIZE); -} - -static void sg_copy_buf(void *buf, struct scatterlist *sg, - unsigned int start, unsigned int nbytes, int out) -{ - struct scatter_walk walk; - - if (!nbytes) - return; - - scatterwalk_start(&walk, sg); - scatterwalk_advance(&walk, start); - scatterwalk_copychunks(buf, &walk, nbytes, out); - scatterwalk_done(&walk, out, 0); -} - -static int sg_copy(struct scatterlist **sg, size_t *offset, void *buf, - size_t buflen, size_t total, int out) -{ - unsigned int count, off = 0; - - while (buflen && total) { - count = min((*sg)->length - *offset, total); - count = min(count, buflen); - - if (!count) - return off; - - sg_copy_buf(buf + off, *sg, *offset, count, out); - - off += count; - buflen -= count; - *offset += count; - total -= count; - - if (*offset == (*sg)->length) { - *sg = sg_next(*sg); - if (*sg) - *offset = 0; - else - total = 0; - } - } - - return off; -} - -static int omap_aes_crypt_dma(struct crypto_tfm *tfm, dma_addr_t dma_addr_in, - dma_addr_t dma_addr_out, int length) -{ - struct omap_aes_ctx *ctx = crypto_tfm_ctx(tfm); - struct omap_aes_dev *dd = ctx->dd; - int len32; - - pr_debug("len: %d\n", length); - - dd->dma_size = length; - - if (!(dd->flags & FLAGS_FAST)) - dma_sync_single_for_device(dd->dev, dma_addr_in, length, - DMA_TO_DEVICE); - - len32 = DIV_ROUND_UP(length, sizeof(u32)); - - /* IN */ - omap_set_dma_transfer_params(dd->dma_lch_in, OMAP_DMA_DATA_TYPE_S32, - len32, 1, OMAP_DMA_SYNC_PACKET, dd->dma_in, - OMAP_DMA_DST_SYNC); - - omap_set_dma_src_params(dd->dma_lch_in, 0, OMAP_DMA_AMODE_POST_INC, - dma_addr_in, 0, 0); - - /* OUT */ - omap_set_dma_transfer_params(dd->dma_lch_out, OMAP_DMA_DATA_TYPE_S32, - len32, 1, OMAP_DMA_SYNC_PACKET, - dd->dma_out, OMAP_DMA_SRC_SYNC); - - omap_set_dma_dest_params(dd->dma_lch_out, 0, OMAP_DMA_AMODE_POST_INC, - dma_addr_out, 0, 0); - - omap_start_dma(dd->dma_lch_in); - omap_start_dma(dd->dma_lch_out); - - omap_aes_write_ctrl(dd); - - return 0; -} - -static int omap_aes_crypt_dma_start(struct omap_aes_dev *dd) -{ - struct crypto_tfm *tfm = crypto_ablkcipher_tfm( - crypto_ablkcipher_reqtfm(dd->req)); - int err, fast = 0, in, out; - size_t count; - dma_addr_t addr_in, addr_out; - - pr_debug("total: %d\n", dd->total); - - if (sg_is_last(dd->in_sg) && sg_is_last(dd->out_sg)) { - /* check for alignment */ - in = IS_ALIGNED((u32)dd->in_sg->offset, sizeof(u32)); - out = IS_ALIGNED((u32)dd->out_sg->offset, sizeof(u32)); - - fast = in && out; - } - - if (fast) { - count = min(dd->total, sg_dma_len(dd->in_sg)); - count = min(count, sg_dma_len(dd->out_sg)); - - if (count != dd->total) - return -EINVAL; - - pr_debug("fast\n"); - - err = dma_map_sg(dd->dev, dd->in_sg, 1, DMA_TO_DEVICE); - if (!err) { - dev_err(dd->dev, "dma_map_sg() error\n"); - return -EINVAL; - } - - err = dma_map_sg(dd->dev, dd->out_sg, 1, DMA_FROM_DEVICE); - if (!err) { - dev_err(dd->dev, "dma_map_sg() error\n"); - dma_unmap_sg(dd->dev, dd->in_sg, 1, DMA_TO_DEVICE); - return -EINVAL; - } - - addr_in = sg_dma_address(dd->in_sg); - addr_out = sg_dma_address(dd->out_sg); - - dd->flags |= FLAGS_FAST; - - } else { - /* use cache buffers */ - count = sg_copy(&dd->in_sg, &dd->in_offset, dd->buf_in, - dd->buflen, dd->total, 0); - - addr_in = dd->dma_addr_in; - addr_out = dd->dma_addr_out; - - dd->flags &= ~FLAGS_FAST; - - } - - dd->total -= count; - - err = omap_aes_hw_init(dd); - - err = omap_aes_crypt_dma(tfm, addr_in, addr_out, count); - - return err; -} - -static void omap_aes_finish_req(struct omap_aes_dev *dd, int err) -{ - struct omap_aes_ctx *ctx; - - pr_debug("err: %d\n", err); - - ctx = crypto_ablkcipher_ctx(crypto_ablkcipher_reqtfm(dd->req)); - - if (!dd->total) - dd->req->base.complete(&dd->req->base, err); -} - -static int omap_aes_crypt_dma_stop(struct omap_aes_dev *dd) -{ - int err = 0; - size_t count; - - pr_debug("total: %d\n", dd->total); - - omap_aes_write_mask(dd, AES_REG_MASK, 0, AES_REG_MASK_START); - - omap_aes_hw_cleanup(dd); - - omap_stop_dma(dd->dma_lch_in); - omap_stop_dma(dd->dma_lch_out); - - if (dd->flags & FLAGS_FAST) { - dma_unmap_sg(dd->dev, dd->out_sg, 1, DMA_FROM_DEVICE); - dma_unmap_sg(dd->dev, dd->in_sg, 1, DMA_TO_DEVICE); - } else { - dma_sync_single_for_device(dd->dev, dd->dma_addr_out, - dd->dma_size, DMA_FROM_DEVICE); - - /* copy data */ - count = sg_copy(&dd->out_sg, &dd->out_offset, dd->buf_out, - dd->buflen, dd->dma_size, 1); - if (count != dd->dma_size) { - err = -EINVAL; - pr_err("not all data converted: %u\n", count); - } - } - - if (err || !dd->total) - omap_aes_finish_req(dd, err); - - return err; -} - -static int omap_aes_handle_req(struct omap_aes_dev *dd) -{ - struct crypto_async_request *async_req, *backlog; - struct omap_aes_ctx *ctx; - struct omap_aes_reqctx *rctx; - struct ablkcipher_request *req; - unsigned long flags; - - if (dd->total) - goto start; - - spin_lock_irqsave(&dd->lock, flags); - backlog = crypto_get_backlog(&dd->queue); - async_req = crypto_dequeue_request(&dd->queue); - if (!async_req) - clear_bit(FLAGS_BUSY, &dd->flags); - spin_unlock_irqrestore(&dd->lock, flags); - - if (!async_req) - return 0; - - if (backlog) - backlog->complete(backlog, -EINPROGRESS); - - req = ablkcipher_request_cast(async_req); - - pr_debug("get new req\n"); - - /* assign new request to device */ - dd->req = req; - dd->total = req->nbytes; - dd->in_offset = 0; - dd->in_sg = req->src; - dd->out_offset = 0; - dd->out_sg = req->dst; - - rctx = ablkcipher_request_ctx(req); - ctx = crypto_ablkcipher_ctx(crypto_ablkcipher_reqtfm(req)); - rctx->mode &= FLAGS_MODE_MASK; - dd->flags = (dd->flags & ~FLAGS_MODE_MASK) | rctx->mode; - - dd->iv = req->info; - if ((dd->flags & FLAGS_CBC) && dd->iv) - dd->flags |= FLAGS_NEW_IV; - else - dd->flags &= ~FLAGS_NEW_IV; - - ctx->dd = dd; - if (dd->ctx != ctx) { - /* assign new context to device */ - dd->ctx = ctx; - ctx->flags |= FLAGS_NEW_KEY; - } - - if (!IS_ALIGNED(req->nbytes, AES_BLOCK_SIZE)) - pr_err("request size is not exact amount of AES blocks\n"); - -start: - return omap_aes_crypt_dma_start(dd); -} - -static void omap_aes_task(unsigned long data) -{ - struct omap_aes_dev *dd = (struct omap_aes_dev *)data; - int err; - - pr_debug("enter\n"); - - err = omap_aes_crypt_dma_stop(dd); - - err = omap_aes_handle_req(dd); - - pr_debug("exit\n"); -} - -static int omap_aes_crypt(struct ablkcipher_request *req, unsigned long mode) -{ - struct omap_aes_ctx *ctx = crypto_ablkcipher_ctx( - crypto_ablkcipher_reqtfm(req)); - struct omap_aes_reqctx *rctx = ablkcipher_request_ctx(req); - struct omap_aes_dev *dd; - unsigned long flags; - int err; - - pr_debug("nbytes: %d, enc: %d, cbc: %d\n", req->nbytes, - !!(mode & FLAGS_ENCRYPT), - !!(mode & FLAGS_CBC)); - - dd = omap_aes_find_dev(ctx); - if (!dd) - return -ENODEV; - - rctx->mode = mode; - - spin_lock_irqsave(&dd->lock, flags); - err = ablkcipher_enqueue_request(&dd->queue, req); - spin_unlock_irqrestore(&dd->lock, flags); - - if (!test_and_set_bit(FLAGS_BUSY, &dd->flags)) - omap_aes_handle_req(dd); - - pr_debug("exit\n"); - - return err; -} - -/* ********************** ALG API ************************************ */ - -static int omap_aes_setkey(struct crypto_ablkcipher *tfm, const u8 *key, - unsigned int keylen) -{ - struct omap_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm); - - if (keylen != AES_KEYSIZE_128 && keylen != AES_KEYSIZE_192 && - keylen != AES_KEYSIZE_256) - return -EINVAL; - - pr_debug("enter, keylen: %d\n", keylen); - - memcpy(ctx->key, key, keylen); - ctx->keylen = keylen; - ctx->flags |= FLAGS_NEW_KEY; - - return 0; -} - -static int omap_aes_ecb_encrypt(struct ablkcipher_request *req) -{ - return omap_aes_crypt(req, FLAGS_ENCRYPT); -} - -static int omap_aes_ecb_decrypt(struct ablkcipher_request *req) -{ - return omap_aes_crypt(req, 0); -} - -static int omap_aes_cbc_encrypt(struct ablkcipher_request *req) -{ - return omap_aes_crypt(req, FLAGS_ENCRYPT | FLAGS_CBC); -} - -static int omap_aes_cbc_decrypt(struct ablkcipher_request *req) -{ - return omap_aes_crypt(req, FLAGS_CBC); -} - -static int omap_aes_cra_init(struct crypto_tfm *tfm) -{ - pr_debug("enter\n"); - - tfm->crt_ablkcipher.reqsize = sizeof(struct omap_aes_reqctx); - - return 0; -} - -static void omap_aes_cra_exit(struct crypto_tfm *tfm) -{ - pr_debug("enter\n"); -} - -/* ********************** ALGS ************************************ */ - -static struct crypto_alg algs[] = { -{ - .cra_name = "ecb(aes)", - .cra_driver_name = "ecb-aes-omap", - .cra_priority = 100, - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, - .cra_blocksize = AES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct omap_aes_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_ablkcipher_type, - .cra_module = THIS_MODULE, - .cra_init = omap_aes_cra_init, - .cra_exit = omap_aes_cra_exit, - .cra_u.ablkcipher = { - .min_keysize = AES_MIN_KEY_SIZE, - .max_keysize = AES_MAX_KEY_SIZE, - .setkey = omap_aes_setkey, - .encrypt = omap_aes_ecb_encrypt, - .decrypt = omap_aes_ecb_decrypt, - } -}, -{ - .cra_name = "cbc(aes)", - .cra_driver_name = "cbc-aes-omap", - .cra_priority = 100, - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | CRYPTO_ALG_ASYNC, - .cra_blocksize = AES_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct omap_aes_ctx), - .cra_alignmask = 0, - .cra_type = &crypto_ablkcipher_type, - .cra_module = THIS_MODULE, - .cra_init = omap_aes_cra_init, - .cra_exit = omap_aes_cra_exit, - .cra_u.ablkcipher = { - .min_keysize = AES_MIN_KEY_SIZE, - .max_keysize = AES_MAX_KEY_SIZE, - .ivsize = AES_BLOCK_SIZE, - .setkey = omap_aes_setkey, - .encrypt = omap_aes_cbc_encrypt, - .decrypt = omap_aes_cbc_decrypt, - } -} -}; - -static int omap_aes_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct omap_aes_dev *dd; - struct resource *res; - int err = -ENOMEM, i, j; - u32 reg; - - dd = kzalloc(sizeof(struct omap_aes_dev), GFP_KERNEL); - if (dd == NULL) { - dev_err(dev, "unable to alloc data struct.\n"); - goto err_data; - } - dd->dev = dev; - platform_set_drvdata(pdev, dd); - - spin_lock_init(&dd->lock); - crypto_init_queue(&dd->queue, OMAP_AES_QUEUE_LENGTH); - - /* Get the base address */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, "invalid resource type\n"); - err = -ENODEV; - goto err_res; - } - dd->phys_base = res->start; - - /* Get the DMA */ - res = platform_get_resource(pdev, IORESOURCE_DMA, 0); - if (!res) - dev_info(dev, "no DMA info\n"); - else - dd->dma_out = res->start; - - /* Get the DMA */ - res = platform_get_resource(pdev, IORESOURCE_DMA, 1); - if (!res) - dev_info(dev, "no DMA info\n"); - else - dd->dma_in = res->start; - - /* Initializing the clock */ - dd->iclk = clk_get(dev, "ick"); - if (!dd->iclk) { - dev_err(dev, "clock intialization failed.\n"); - err = -ENODEV; - goto err_res; - } - - dd->io_base = ioremap(dd->phys_base, SZ_4K); - if (!dd->io_base) { - dev_err(dev, "can't ioremap\n"); - err = -ENOMEM; - goto err_io; - } - - clk_enable(dd->iclk); - reg = omap_aes_read(dd, AES_REG_REV); - dev_info(dev, "OMAP AES hw accel rev: %u.%u\n", - (reg & AES_REG_REV_MAJOR) >> 4, reg & AES_REG_REV_MINOR); - clk_disable(dd->iclk); - - tasklet_init(&dd->task, omap_aes_task, (unsigned long)dd); - - err = omap_aes_dma_init(dd); - if (err) - goto err_dma; - - INIT_LIST_HEAD(&dd->list); - spin_lock(&list_lock); - list_add_tail(&dd->list, &dev_list); - spin_unlock(&list_lock); - - for (i = 0; i < ARRAY_SIZE(algs); i++) { - pr_debug("i: %d\n", i); - INIT_LIST_HEAD(&algs[i].cra_list); - err = crypto_register_alg(&algs[i]); - if (err) - goto err_algs; - } - - pr_info("probe() done\n"); - - return 0; -err_algs: - for (j = 0; j < i; j++) - crypto_unregister_alg(&algs[j]); - omap_aes_dma_cleanup(dd); -err_dma: - tasklet_kill(&dd->task); - iounmap(dd->io_base); -err_io: - clk_put(dd->iclk); -err_res: - kfree(dd); - dd = NULL; -err_data: - dev_err(dev, "initialization failed.\n"); - return err; -} - -static int omap_aes_remove(struct platform_device *pdev) -{ - struct omap_aes_dev *dd = platform_get_drvdata(pdev); - int i; - - if (!dd) - return -ENODEV; - - spin_lock(&list_lock); - list_del(&dd->list); - spin_unlock(&list_lock); - - for (i = 0; i < ARRAY_SIZE(algs); i++) - crypto_unregister_alg(&algs[i]); - - tasklet_kill(&dd->task); - omap_aes_dma_cleanup(dd); - iounmap(dd->io_base); - clk_put(dd->iclk); - kfree(dd); - dd = NULL; - - return 0; -} - -static struct platform_driver omap_aes_driver = { - .probe = omap_aes_probe, - .remove = omap_aes_remove, - .driver = { - .name = "omap-aes", - .owner = THIS_MODULE, - }, -}; - -static int __init omap_aes_mod_init(void) -{ - pr_info("loading %s driver\n", "omap-aes"); - - if (!cpu_class_is_omap2() || omap_type() != OMAP2_DEVICE_TYPE_SEC) { - pr_err("Unsupported cpu\n"); - return -ENODEV; - } - - return platform_driver_register(&omap_aes_driver); -} - -static void __exit omap_aes_mod_exit(void) -{ - platform_driver_unregister(&omap_aes_driver); -} - -module_init(omap_aes_mod_init); -module_exit(omap_aes_mod_exit); - -MODULE_DESCRIPTION("OMAP AES hw acceleration support."); -MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Dmitry Kasatkin"); - diff --git a/trunk/drivers/crypto/omap-sham.c b/trunk/drivers/crypto/omap-sham.c index a081c7c7d03f..7d1485676886 100644 --- a/trunk/drivers/crypto/omap-sham.c +++ b/trunk/drivers/crypto/omap-sham.c @@ -311,8 +311,7 @@ static int omap_sham_xmit_dma(struct omap_sham_dev *dd, dma_addr_t dma_addr, len32 = DIV_ROUND_UP(length, sizeof(u32)); omap_set_dma_transfer_params(dd->dma_lch, OMAP_DMA_DATA_TYPE_S32, len32, - 1, OMAP_DMA_SYNC_PACKET, dd->dma, - OMAP_DMA_DST_SYNC_PREFETCH); + 1, OMAP_DMA_SYNC_PACKET, dd->dma, OMAP_DMA_DST_SYNC); omap_set_dma_src_params(dd->dma_lch, 0, OMAP_DMA_AMODE_POST_INC, dma_addr, 0, 0); @@ -1073,9 +1072,6 @@ static int omap_sham_dma_init(struct omap_sham_dev *dd) omap_set_dma_dest_burst_mode(dd->dma_lch, OMAP_DMA_DATA_BURST_16); - omap_set_dma_src_burst_mode(dd->dma_lch, - OMAP_DMA_DATA_BURST_4); - return 0; } diff --git a/trunk/drivers/crypto/talitos.c b/trunk/drivers/crypto/talitos.c index b879c3f5d7c0..4bcd825b5739 100644 --- a/trunk/drivers/crypto/talitos.c +++ b/trunk/drivers/crypto/talitos.c @@ -161,7 +161,7 @@ struct talitos_private { static void to_talitos_ptr(struct talitos_ptr *talitos_ptr, dma_addr_t dma_addr) { talitos_ptr->ptr = cpu_to_be32(lower_32_bits(dma_addr)); - talitos_ptr->eptr = upper_32_bits(dma_addr); + talitos_ptr->eptr = cpu_to_be32(upper_32_bits(dma_addr)); } /* @@ -332,9 +332,10 @@ static int talitos_submit(struct device *dev, struct talitos_desc *desc, /* GO! */ wmb(); - out_be32(priv->reg + TALITOS_FF(ch), upper_32_bits(request->dma_desc)); + out_be32(priv->reg + TALITOS_FF(ch), + cpu_to_be32(upper_32_bits(request->dma_desc))); out_be32(priv->reg + TALITOS_FF_LO(ch), - lower_32_bits(request->dma_desc)); + cpu_to_be32(lower_32_bits(request->dma_desc))); spin_unlock_irqrestore(&priv->chan[ch].head_lock, flags); @@ -1750,14 +1751,14 @@ static int ahash_init_sha224_swinit(struct ahash_request *areq) ahash_init(areq); req_ctx->swinit = 1;/* prevent h/w initting context with sha256 values*/ - req_ctx->hw_context[0] = SHA224_H0; - req_ctx->hw_context[1] = SHA224_H1; - req_ctx->hw_context[2] = SHA224_H2; - req_ctx->hw_context[3] = SHA224_H3; - req_ctx->hw_context[4] = SHA224_H4; - req_ctx->hw_context[5] = SHA224_H5; - req_ctx->hw_context[6] = SHA224_H6; - req_ctx->hw_context[7] = SHA224_H7; + req_ctx->hw_context[0] = cpu_to_be32(SHA224_H0); + req_ctx->hw_context[1] = cpu_to_be32(SHA224_H1); + req_ctx->hw_context[2] = cpu_to_be32(SHA224_H2); + req_ctx->hw_context[3] = cpu_to_be32(SHA224_H3); + req_ctx->hw_context[4] = cpu_to_be32(SHA224_H4); + req_ctx->hw_context[5] = cpu_to_be32(SHA224_H5); + req_ctx->hw_context[6] = cpu_to_be32(SHA224_H6); + req_ctx->hw_context[7] = cpu_to_be32(SHA224_H7); /* init 64-bit count */ req_ctx->hw_context[8] = 0; @@ -2332,7 +2333,8 @@ static int talitos_remove(struct platform_device *ofdev) talitos_unregister_rng(dev); for (i = 0; i < priv->num_channels; i++) - kfree(priv->chan[i].fifo); + if (priv->chan[i].fifo) + kfree(priv->chan[i].fifo); kfree(priv->chan); @@ -2387,9 +2389,6 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, DESC_HDR_MODE0_MDEU_SHA256; } break; - default: - dev_err(dev, "unknown algorithm type %d\n", t_alg->algt.type); - return ERR_PTR(-EINVAL); } alg->cra_module = THIS_MODULE; diff --git a/trunk/drivers/hid/Kconfig b/trunk/drivers/hid/Kconfig index 3052e2969ad0..6369ba7f96f8 100644 --- a/trunk/drivers/hid/Kconfig +++ b/trunk/drivers/hid/Kconfig @@ -56,20 +56,20 @@ menu "Special HID drivers" depends on HID config HID_3M_PCT - tristate "3M PCT touchscreen" + tristate "3M PCT" depends on USB_HID ---help--- Support for 3M PCT touch screens. config HID_A4TECH - tristate "A4 tech mice" if EMBEDDED + tristate "A4 tech" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- Support for A4 tech X5 and WOP-35 / Trust 450L mice. config HID_ACRUX_FF - tristate "ACRUX force feedback" + tristate "ACRUX force feedback support" depends on USB_HID select INPUT_FF_MEMLESS ---help--- @@ -77,7 +77,7 @@ config HID_ACRUX_FF game controllers. config HID_APPLE - tristate "Apple {i,Power,Mac}Books" if EMBEDDED + tristate "Apple" if EMBEDDED depends on (USB_HID || BT_HIDP) default !EMBEDDED ---help--- @@ -88,7 +88,7 @@ config HID_APPLE MacBooks, MacBook Pros and Apple Aluminum. config HID_BELKIN - tristate "Belkin Flip KVM and Wireless keyboard" if EMBEDDED + tristate "Belkin" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- @@ -101,14 +101,14 @@ config HID_CANDO Support for Cando dual touch panel. config HID_CHERRY - tristate "Cherry Cymotion keyboard" if EMBEDDED + tristate "Cherry" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- Support for Cherry Cymotion keyboard. config HID_CHICONY - tristate "Chicony Tactical pad" if EMBEDDED + tristate "Chicony" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- @@ -130,20 +130,20 @@ config HID_PRODIKEYS and some additional multimedia keys. config HID_CYPRESS - tristate "Cypress mouse and barcode readers" if EMBEDDED + tristate "Cypress" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- Support for cypress mouse and barcode readers. config HID_DRAGONRISE - tristate "DragonRise Inc. game controller" + tristate "DragonRise Inc. support" depends on USB_HID ---help--- Say Y here if you have DragonRise Inc.game controllers. config DRAGONRISE_FF - bool "DragonRise Inc. force feedback" + bool "DragonRise Inc. force feedback support" depends on HID_DRAGONRISE select INPUT_FF_MEMLESS ---help--- @@ -157,58 +157,46 @@ config HID_EGALAX Support for the eGalax dual-touch panel. config HID_ELECOM - tristate "ELECOM BM084 bluetooth mouse" + tristate "ELECOM" depends on BT_HIDP ---help--- Support for the ELECOM BM084 (bluetooth mouse). config HID_EZKEY - tristate "Ezkey BTC 8193 keyboard" if EMBEDDED + tristate "Ezkey" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- Support for Ezkey BTC 8193 keyboard. config HID_KYE - tristate "Kye/Genius Ergo Mouse" if EMBEDDED + tristate "Kye" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- Support for Kye/Genius Ergo Mouse. -config HID_UCLOGIC - tristate "UC-Logic" - depends on USB_HID - ---help--- - Support for UC-Logic tablets. - -config HID_WALTOP - tristate "Waltop" - depends on USB_HID - ---help--- - Support for Waltop tablets. - config HID_GYRATION - tristate "Gyration remote control" + tristate "Gyration" depends on USB_HID ---help--- Support for Gyration remote control. config HID_TWINHAN - tristate "Twinhan IR remote control" + tristate "Twinhan" depends on USB_HID ---help--- Support for Twinhan IR remote control. config HID_KENSINGTON - tristate "Kensington Slimblade Trackball" if EMBEDDED + tristate "Kensington" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- Support for Kensington Slimblade Trackball. config HID_LOGITECH - tristate "Logitech devices" if EMBEDDED + tristate "Logitech" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- @@ -232,12 +220,12 @@ config LOGITECH_FF force feedback. config LOGIRUMBLEPAD2_FF - bool "Logitech RumblePad/Rumblepad 2 force feedback support" + bool "Logitech Rumblepad 2 force feedback support" depends on HID_LOGITECH select INPUT_FF_MEMLESS help Say Y here if you want to enable force feedback support for Logitech - RumblePad and Rumblepad 2 devices. + Rumblepad 2 devices. config LOGIG940_FF bool "Logitech Flight System G940 force feedback support" @@ -247,14 +235,6 @@ config LOGIG940_FF Say Y here if you want to enable force feedback support for Logitech Flight System G940 devices. -config LOGIWII_FF - bool "Logitech Speed Force Wireless force feedback support" - depends on HID_LOGITECH - select INPUT_FF_MEMLESS - help - Say Y here if you want to enable force feedback support for Logitech - Speed Force Wireless (Wii) devices. - config HID_MAGICMOUSE tristate "Apple MagicMouse multi-touch support" depends on BT_HIDP @@ -265,39 +245,39 @@ config HID_MAGICMOUSE Apple Wireless "Magic" Mouse. config HID_MICROSOFT - tristate "Microsoft non-fully HID-compliant devices" if EMBEDDED + tristate "Microsoft" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- Support for Microsoft devices that are not fully compliant with HID standard. config HID_MOSART - tristate "MosArt dual-touch panels" + tristate "MosArt" depends on USB_HID ---help--- Support for MosArt dual-touch panels. config HID_MONTEREY - tristate "Monterey Genius KB29E keyboard" if EMBEDDED + tristate "Monterey" if EMBEDDED depends on USB_HID default !EMBEDDED ---help--- Support for Monterey Genius KB29E. config HID_NTRIG - tristate "N-Trig touch screen" + tristate "NTrig" depends on USB_HID ---help--- Support for N-Trig touch screen. config HID_ORTEK - tristate "Ortek WKB-2000 wireless keyboard and mouse trackpad" + tristate "Ortek" depends on USB_HID ---help--- Support for Ortek WKB-2000 wireless keyboard + mouse trackpad. config HID_PANTHERLORD - tristate "Pantherlord/GreenAsia game controller" + tristate "Pantherlord support" depends on USB_HID ---help--- Say Y here if you have a PantherLord/GreenAsia based game controller @@ -312,7 +292,7 @@ config PANTHERLORD_FF or adapter and want to enable force feedback support for it. config HID_PETALYNX - tristate "Petalynx Maxter remote control" + tristate "Petalynx" depends on USB_HID ---help--- Support for Petalynx Maxter remote control. @@ -376,7 +356,7 @@ config HID_PICOLCD_LEDS Provide access to PicoLCD's GPO pins via leds class. config HID_QUANTA - tristate "Quanta Optical Touch panels" + tristate "Quanta Optical Touch" depends on USB_HID ---help--- Support for Quanta Optical Touch dual-touch panels. @@ -396,39 +376,32 @@ config HID_ROCCAT_KONE ---help--- Support for Roccat Kone mouse. -config HID_ROCCAT_PYRA - tristate "Roccat Pyra mouse support" - depends on USB_HID - select HID_ROCCAT - ---help--- - Support for Roccat Pyra mouse. - config HID_SAMSUNG - tristate "Samsung InfraRed remote control or keyboards" + tristate "Samsung" depends on USB_HID ---help--- Support for Samsung InfraRed remote control or keyboards. config HID_SONY - tristate "Sony PS3 controller" + tristate "Sony" depends on USB_HID ---help--- Support for Sony PS3 controller. config HID_STANTUM - tristate "Stantum multitouch panel" + tristate "Stantum" depends on USB_HID ---help--- Support for Stantum multitouch panel. config HID_SUNPLUS - tristate "Sunplus wireless desktop" + tristate "Sunplus" depends on USB_HID ---help--- Support for Sunplus wireless desktop. config HID_GREENASIA - tristate "GreenAsia (Product ID 0x12) game controller support" + tristate "GreenAsia (Product ID 0x12) support" depends on USB_HID ---help--- Say Y here if you have a GreenAsia (Product ID 0x12) based game diff --git a/trunk/drivers/hid/Makefile b/trunk/drivers/hid/Makefile index c335605b9200..46f037f3df80 100644 --- a/trunk/drivers/hid/Makefile +++ b/trunk/drivers/hid/Makefile @@ -21,9 +21,6 @@ endif ifdef CONFIG_LOGIG940_FF hid-logitech-objs += hid-lg3ff.o endif -ifdef CONFIG_LOGIWII_FF - hid-logitech-objs += hid-lg4ff.o -endif obj-$(CONFIG_HID_3M_PCT) += hid-3m-pct.o obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o @@ -55,7 +52,6 @@ obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o obj-$(CONFIG_HID_PICOLCD) += hid-picolcd.o obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o obj-$(CONFIG_HID_ROCCAT_KONE) += hid-roccat-kone.o -obj-$(CONFIG_HID_ROCCAT_PYRA) += hid-roccat-pyra.o obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o obj-$(CONFIG_HID_SONY) += hid-sony.o @@ -65,11 +61,9 @@ obj-$(CONFIG_HID_GREENASIA) += hid-gaff.o obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o -obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o obj-$(CONFIG_HID_ZYDACRON) += hid-zydacron.o obj-$(CONFIG_HID_WACOM) += hid-wacom.o -obj-$(CONFIG_HID_WALTOP) += hid-waltop.o obj-$(CONFIG_USB_HID) += usbhid/ obj-$(CONFIG_USB_MOUSE) += usbhid/ diff --git a/trunk/drivers/hid/hid-3m-pct.c b/trunk/drivers/hid/hid-3m-pct.c index 02d8cd3b1b1b..2a0d56b7a02b 100644 --- a/trunk/drivers/hid/hid-3m-pct.c +++ b/trunk/drivers/hid/hid-3m-pct.c @@ -2,8 +2,6 @@ * HID driver for 3M PCT multitouch panels * * Copyright (c) 2009-2010 Stephane Chatty - * Copyright (c) 2010 Henrik Rydberg - * Copyright (c) 2010 Canonical, Ltd. * */ @@ -26,26 +24,15 @@ MODULE_LICENSE("GPL"); #include "hid-ids.h" -#define MAX_SLOTS 60 -#define MAX_TRKID USHRT_MAX -#define MAX_EVENTS 360 - -/* estimated signal-to-noise ratios */ -#define SN_MOVE 2048 -#define SN_WIDTH 128 - struct mmm_finger { __s32 x, y, w, h; - __u16 id; - bool prev_touch; + __u8 rank; bool touch, valid; }; struct mmm_data { - struct mmm_finger f[MAX_SLOTS]; - __u16 id; - __u8 curid; - __u8 nexp, nreal; + struct mmm_finger f[10]; + __u8 curid, num; bool touch, valid; }; @@ -53,10 +40,6 @@ static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { - int f1 = field->logical_minimum; - int f2 = field->logical_maximum; - int df = f2 - f1; - switch (usage->hid & HID_USAGE_PAGE) { case HID_UP_BUTTON: @@ -67,20 +50,18 @@ static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi, case HID_GD_X: hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_POSITION_X); - input_set_abs_params(hi->input, ABS_MT_POSITION_X, - f1, f2, df / SN_MOVE, 0); /* touchscreen emulation */ input_set_abs_params(hi->input, ABS_X, - f1, f2, df / SN_MOVE, 0); + field->logical_minimum, + field->logical_maximum, 0, 0); return 1; case HID_GD_Y: hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_POSITION_Y); - input_set_abs_params(hi->input, ABS_MT_POSITION_Y, - f1, f2, df / SN_MOVE, 0); /* touchscreen emulation */ input_set_abs_params(hi->input, ABS_Y, - f1, f2, df / SN_MOVE, 0); + field->logical_minimum, + field->logical_maximum, 0, 0); return 1; } return 0; @@ -100,31 +81,21 @@ static int mmm_input_mapping(struct hid_device *hdev, struct hid_input *hi, case HID_DG_TIPSWITCH: /* touchscreen emulation */ hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH); - input_set_capability(hi->input, EV_KEY, BTN_TOUCH); return 1; case HID_DG_WIDTH: hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_TOUCH_MAJOR); - input_set_abs_params(hi->input, ABS_MT_TOUCH_MAJOR, - f1, f2, df / SN_WIDTH, 0); return 1; case HID_DG_HEIGHT: hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_TOUCH_MINOR); - input_set_abs_params(hi->input, ABS_MT_TOUCH_MINOR, - f1, f2, df / SN_WIDTH, 0); input_set_abs_params(hi->input, ABS_MT_ORIENTATION, - 0, 1, 0, 0); + 1, 1, 0, 0); return 1; case HID_DG_CONTACTID: - field->logical_maximum = MAX_TRKID; + field->logical_maximum = 59; hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_TRACKING_ID); - input_set_abs_params(hi->input, ABS_MT_TRACKING_ID, - 0, MAX_TRKID, 0, 0); - if (!hi->input->mt) - input_mt_create_slots(hi->input, MAX_SLOTS); - input_set_events_per_packet(hi->input, MAX_EVENTS); return 1; } /* let hid-input decide for the others */ @@ -142,10 +113,10 @@ static int mmm_input_mapped(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { - /* tell hid-input to skip setup of these event types */ if (usage->type == EV_KEY || usage->type == EV_ABS) - set_bit(usage->type, hi->input->evbit); - return -1; + clear_bit(usage->code, *bit); + + return 0; } /* @@ -155,49 +126,70 @@ static int mmm_input_mapped(struct hid_device *hdev, struct hid_input *hi, static void mmm_filter_event(struct mmm_data *md, struct input_dev *input) { struct mmm_finger *oldest = 0; + bool pressed = false, released = false; int i; - for (i = 0; i < MAX_SLOTS; ++i) { + + /* + * we need to iterate on all fingers to decide if we have a press + * or a release event in our touchscreen emulation. + */ + for (i = 0; i < 10; ++i) { struct mmm_finger *f = &md->f[i]; if (!f->valid) { /* this finger is just placeholder data, ignore */ - continue; - } - input_mt_slot(input, i); - if (f->touch) { + } else if (f->touch) { /* this finger is on the screen */ int wide = (f->w > f->h); - /* divided by two to match visual scale of touch */ - int major = max(f->w, f->h) >> 1; - int minor = min(f->w, f->h) >> 1; - - if (!f->prev_touch) - f->id = md->id++; - input_event(input, EV_ABS, ABS_MT_TRACKING_ID, f->id); + input_event(input, EV_ABS, ABS_MT_TRACKING_ID, i); input_event(input, EV_ABS, ABS_MT_POSITION_X, f->x); input_event(input, EV_ABS, ABS_MT_POSITION_Y, f->y); input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide); - input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major); - input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor); - /* touchscreen emulation: pick the oldest contact */ - if (!oldest || ((f->id - oldest->id) & (SHRT_MAX + 1))) + input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, + wide ? f->w : f->h); + input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, + wide ? f->h : f->w); + input_mt_sync(input); + /* + * touchscreen emulation: maintain the age rank + * of this finger, decide if we have a press + */ + if (f->rank == 0) { + f->rank = ++(md->num); + if (f->rank == 1) + pressed = true; + } + if (f->rank == 1) oldest = f; } else { /* this finger took off the screen */ - input_event(input, EV_ABS, ABS_MT_TRACKING_ID, -1); + /* touchscreen emulation: maintain age rank of others */ + int j; + + for (j = 0; j < 10; ++j) { + struct mmm_finger *g = &md->f[j]; + if (g->rank > f->rank) { + g->rank--; + if (g->rank == 1) + oldest = g; + } + } + f->rank = 0; + --(md->num); + if (md->num == 0) + released = true; } - f->prev_touch = f->touch; f->valid = 0; } /* touchscreen emulation */ if (oldest) { - input_event(input, EV_KEY, BTN_TOUCH, 1); + if (pressed) + input_event(input, EV_KEY, BTN_TOUCH, 1); input_event(input, EV_ABS, ABS_X, oldest->x); input_event(input, EV_ABS, ABS_Y, oldest->y); - } else { + } else if (released) { input_event(input, EV_KEY, BTN_TOUCH, 0); } - input_sync(input); } /* @@ -231,12 +223,10 @@ static int mmm_event(struct hid_device *hid, struct hid_field *field, md->f[md->curid].h = value; break; case HID_DG_CONTACTID: - value = clamp_val(value, 0, MAX_SLOTS - 1); if (md->valid) { md->curid = value; md->f[value].touch = md->touch; md->f[value].valid = 1; - md->nreal++; } break; case HID_GD_X: @@ -248,12 +238,7 @@ static int mmm_event(struct hid_device *hid, struct hid_field *field, md->f[md->curid].y = value; break; case HID_DG_CONTACTCOUNT: - if (value) - md->nexp = value; - if (md->nreal >= md->nexp) { - mmm_filter_event(md, input); - md->nreal = 0; - } + mmm_filter_event(md, input); break; } } @@ -270,8 +255,6 @@ static int mmm_probe(struct hid_device *hdev, const struct hid_device_id *id) int ret; struct mmm_data *md; - hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; - md = kzalloc(sizeof(struct mmm_data), GFP_KERNEL); if (!md) { dev_err(&hdev->dev, "cannot allocate 3M data\n"); diff --git a/trunk/drivers/hid/hid-a4tech.c b/trunk/drivers/hid/hid-a4tech.c index 1666c1684e79..3a2b223c1da4 100644 --- a/trunk/drivers/hid/hid-a4tech.c +++ b/trunk/drivers/hid/hid-a4tech.c @@ -133,8 +133,6 @@ static const struct hid_device_id a4_devices[] = { .driver_data = A4_2WHEEL_MOUSE_HACK_7 }, { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D), .driver_data = A4_2WHEEL_MOUSE_HACK_B8 }, - { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649), - .driver_data = A4_2WHEEL_MOUSE_HACK_B8 }, { } }; MODULE_DEVICE_TABLE(hid, a4_devices); diff --git a/trunk/drivers/hid/hid-apple.c b/trunk/drivers/hid/hid-apple.c index eaeca564a8d3..bba05d0a8980 100644 --- a/trunk/drivers/hid/hid-apple.c +++ b/trunk/drivers/hid/hid-apple.c @@ -246,18 +246,17 @@ static int apple_event(struct hid_device *hdev, struct hid_field *field, /* * MacBook JIS keyboard has wrong logical maximum */ -static __u8 *apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void apple_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { struct apple_sc *asc = hid_get_drvdata(hdev); - if ((asc->quirks & APPLE_RDESC_JIS) && *rsize >= 60 && + if ((asc->quirks & APPLE_RDESC_JIS) && rsize >= 60 && rdesc[53] == 0x65 && rdesc[59] == 0x65) { dev_info(&hdev->dev, "fixing up MacBook JIS keyboard report " "descriptor\n"); rdesc[53] = rdesc[59] = 0xe7; } - return rdesc; } static void apple_setup_input(struct input_dev *input) diff --git a/trunk/drivers/hid/hid-cherry.c b/trunk/drivers/hid/hid-cherry.c index e880086c2311..24663a8717b1 100644 --- a/trunk/drivers/hid/hid-cherry.c +++ b/trunk/drivers/hid/hid-cherry.c @@ -26,16 +26,15 @@ * Cherry Cymotion keyboard have an invalid HID report descriptor, * that needs fixing before we can parse it. */ -static __u8 *ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void ch_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { - if (*rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { + if (rsize >= 17 && rdesc[11] == 0x3c && rdesc[12] == 0x02) { dev_info(&hdev->dev, "fixing up Cherry Cymotion report " "descriptor\n"); rdesc[11] = rdesc[16] = 0xff; rdesc[12] = rdesc[17] = 0x03; } - return rdesc; } #define ch_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ diff --git a/trunk/drivers/hid/hid-core.c b/trunk/drivers/hid/hid-core.c index 7832b6e2478b..3cb6632d4518 100644 --- a/trunk/drivers/hid/hid-core.c +++ b/trunk/drivers/hid/hid-core.c @@ -388,6 +388,12 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) __u32 data; unsigned n; + /* Local delimiter could have value 0, which allows size to be 0 */ + if (item->size == 0 && item->tag != HID_LOCAL_ITEM_TAG_DELIMITER) { + dbg_hid("item data expected for local item\n"); + return -1; + } + data = item_udata(item); switch (item->tag) { @@ -645,7 +651,7 @@ int hid_parse_report(struct hid_device *device, __u8 *start, }; if (device->driver->report_fixup) - start = device->driver->report_fixup(device, start, &size); + device->driver->report_fixup(device, start, size); device->rdesc = kmemdup(start, size, GFP_KERNEL); if (device->rdesc == NULL) @@ -1235,7 +1241,6 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_3M, USB_DEVICE_ID_3M2256) }, { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) }, { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) }, - { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) }, #if defined(CONFIG_HID_ACRUX_FF) || defined(CONFIG_HID_ACRUX_FF_MODULE) { HID_USB_DEVICE(USB_VENDOR_ID_ACRUX, 0x0802) }, #endif @@ -1243,7 +1248,6 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IRCONTROL4) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE) }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICTRACKPAD) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO) }, { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI) }, @@ -1323,7 +1327,6 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) }, - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D) }, @@ -1333,7 +1336,6 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL) }, - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACETRAVELLER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_SPACENAVIGATOR) }, @@ -1369,15 +1371,12 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, - { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, USB_DEVICE_ID_MTP_STM) }, - { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX, USB_DEVICE_ID_MTP_SITRONIX) }, { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) }, { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) }, @@ -1389,16 +1388,8 @@ static const struct hid_device_id hid_blacklist[] = { { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, { HID_USB_DEVICE(USB_VENDOR_ID_TWINHAN, USB_DEVICE_ID_TWINHAN_IR_REMOTE) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) }, { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_SMARTJOY_PLUS) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) }, { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) }, { HID_USB_DEVICE(USB_VENDOR_ID_ZYDACRON, USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL) }, diff --git a/trunk/drivers/hid/hid-cypress.c b/trunk/drivers/hid/hid-cypress.c index 4cd0e2345991..998b6f443d7d 100644 --- a/trunk/drivers/hid/hid-cypress.c +++ b/trunk/drivers/hid/hid-cypress.c @@ -31,16 +31,16 @@ * Some USB barcode readers from cypress have usage min and usage max in * the wrong order */ -static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); unsigned int i; if (!(quirks & CP_RDESC_SWAPPED_MIN_MAX)) - return rdesc; + return; - for (i = 0; i < *rsize - 4; i++) + for (i = 0; i < rsize - 4; i++) if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) { __u8 tmp; @@ -50,7 +50,6 @@ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc, rdesc[i + 3] = rdesc[i + 1]; rdesc[i + 1] = tmp; } - return rdesc; } static int cp_input_mapped(struct hid_device *hdev, struct hid_input *hi, diff --git a/trunk/drivers/hid/hid-debug.c b/trunk/drivers/hid/hid-debug.c index 75c5e23d09d2..61a3e572224a 100644 --- a/trunk/drivers/hid/hid-debug.c +++ b/trunk/drivers/hid/hid-debug.c @@ -570,8 +570,6 @@ void hid_debug_event(struct hid_device *hdev, char *buf) buf[i]; list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE; } - - wake_up_interruptible(&hdev->debug_wait); } EXPORT_SYMBOL_GPL(hid_debug_event); diff --git a/trunk/drivers/hid/hid-egalax.c b/trunk/drivers/hid/hid-egalax.c index 54b017ad258d..8ca7f65cf2f8 100644 --- a/trunk/drivers/hid/hid-egalax.c +++ b/trunk/drivers/hid/hid-egalax.c @@ -31,7 +31,7 @@ struct egalax_data { bool first; /* is this the first finger in the frame? */ bool valid; /* valid finger data, or just placeholder? */ bool activity; /* at least one active finger previously? */ - __u16 lastx, lasty, lastz; /* latest valid (x, y, z) in the frame */ + __u16 lastx, lasty; /* latest valid (x, y) in the frame */ }; static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi, @@ -79,10 +79,6 @@ static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi, case HID_DG_TIPPRESSURE: hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_PRESSURE); - /* touchscreen emulation */ - input_set_abs_params(hi->input, ABS_PRESSURE, - field->logical_minimum, - field->logical_maximum, 0, 0); return 1; } return 0; @@ -113,8 +109,8 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input) if (td->valid) { /* emit multitouch events */ input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id); - input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x >> 3); - input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y >> 3); + input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x); + input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y); input_event(input, EV_ABS, ABS_MT_PRESSURE, td->z); input_mt_sync(input); @@ -125,7 +121,6 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input) */ td->lastx = td->x; td->lasty = td->y; - td->lastz = td->z; } /* @@ -134,9 +129,8 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input) * the oldest on the panel, the one we want for single touch */ if (!td->first && td->activity) { - input_event(input, EV_ABS, ABS_X, td->lastx >> 3); - input_event(input, EV_ABS, ABS_Y, td->lasty >> 3); - input_event(input, EV_ABS, ABS_PRESSURE, td->lastz); + input_event(input, EV_ABS, ABS_X, td->lastx); + input_event(input, EV_ABS, ABS_Y, td->lasty); } if (!td->valid) { diff --git a/trunk/drivers/hid/hid-elecom.c b/trunk/drivers/hid/hid-elecom.c index 6e31f305397d..7a40878f46b4 100644 --- a/trunk/drivers/hid/hid-elecom.c +++ b/trunk/drivers/hid/hid-elecom.c @@ -20,15 +20,14 @@ #include "hid-ids.h" -static __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { - if (*rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { + if (rsize >= 48 && rdesc[46] == 0x05 && rdesc[47] == 0x0c) { dev_info(&hdev->dev, "Fixing up Elecom BM084 " "report descriptor.\n"); rdesc[47] = 0x00; } - return rdesc; } static const struct hid_device_id elecom_devices[] = { diff --git a/trunk/drivers/hid/hid-ids.h b/trunk/drivers/hid/hid-ids.h index 3ee999d33004..855aa8e355f4 100644 --- a/trunk/drivers/hid/hid-ids.h +++ b/trunk/drivers/hid/hid-ids.h @@ -25,7 +25,6 @@ #define USB_VENDOR_ID_A4TECH 0x09da #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a -#define USB_DEVICE_ID_A4TECH_RP_649 0x001a #define USB_VENDOR_ID_AASHIMA 0x06d6 #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 @@ -64,7 +63,6 @@ #define USB_VENDOR_ID_APPLE 0x05ac #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304 #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d -#define USB_DEVICE_ID_APPLE_MAGICTRACKPAD 0x030e #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI 0x020e #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO 0x020f #define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214 @@ -144,7 +142,6 @@ #define USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE 0x0051 #define USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE 0x00ff #define USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK 0x00d3 -#define USB_DEVICE_ID_CH_AXIS_295 0x001c #define USB_VENDOR_ID_CHERRY 0x046a #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 @@ -346,7 +343,6 @@ #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f -#define USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD 0xc20a #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD 0xc211 #define USB_DEVICE_ID_LOGITECH_EXTREME_3D 0xc215 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218 @@ -358,7 +354,6 @@ #define USB_DEVICE_ID_LOGITECH_WINGMAN_FFG 0xc293 #define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295 #define USB_DEVICE_ID_LOGITECH_G25_WHEEL 0xc299 -#define USB_DEVICE_ID_LOGITECH_WII_WHEEL 0xc29c #define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a #define USB_DEVICE_ID_S510_RECEIVER 0xc50c #define USB_DEVICE_ID_S510_RECEIVER_2 0xc517 @@ -471,8 +466,6 @@ #define USB_VENDOR_ID_ROCCAT 0x1e7d #define USB_DEVICE_ID_ROCCAT_KONE 0x2ced -#define USB_DEVICE_ID_ROCCAT_PYRA_WIRED 0x2c24 -#define USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS 0x2cf6 #define USB_VENDOR_ID_SAITEK 0x06a3 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 @@ -492,12 +485,6 @@ #define USB_VENDOR_ID_STANTUM 0x1f87 #define USB_DEVICE_ID_MTP 0x0002 -#define USB_VENDOR_ID_STANTUM_STM 0x0483 -#define USB_DEVICE_ID_MTP_STM 0x3261 - -#define USB_VENDOR_ID_STANTUM_SITRONIX 0x1403 -#define USB_DEVICE_ID_MTP_SITRONIX 0x5001 - #define USB_VENDOR_ID_SUN 0x0430 #define USB_DEVICE_ID_RARITAN_KVM_DONGLE 0xcdab @@ -527,10 +514,8 @@ #define USB_VENDOR_ID_UCLOGIC 0x5543 #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 -#define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 #define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003 -#define USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U 0x0004 -#define USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U 0x0005 +#define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 #define USB_VENDOR_ID_VERNIER 0x08f7 #define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 @@ -542,12 +527,6 @@ #define USB_VENDOR_ID_WACOM 0x056a #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81 -#define USB_VENDOR_ID_WALTOP 0x172f -#define USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH 0x0032 -#define USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH 0x0034 -#define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH 0x0501 -#define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH 0x0500 - #define USB_VENDOR_ID_WISEGROUP 0x0925 #define USB_DEVICE_ID_SMARTJOY_PLUS 0x0005 #define USB_DEVICE_ID_1_PHIDGETSERVO_20 0x8101 diff --git a/trunk/drivers/hid/hid-input.c b/trunk/drivers/hid/hid-input.c index 834ef47b76d6..6c03dcc5760a 100644 --- a/trunk/drivers/hid/hid-input.c +++ b/trunk/drivers/hid/hid-input.c @@ -149,83 +149,6 @@ static int hidinput_setkeycode(struct input_dev *dev, } -/** - * hidinput_calc_abs_res - calculate an absolute axis resolution - * @field: the HID report field to calculate resolution for - * @code: axis code - * - * The formula is: - * (logical_maximum - logical_minimum) - * resolution = ---------------------------------------------------------- - * (physical_maximum - physical_minimum) * 10 ^ unit_exponent - * - * as seen in the HID specification v1.11 6.2.2.7 Global Items. - * - * Only exponent 1 length units are processed. Centimeters are converted to - * inches. Degrees are converted to radians. - */ -static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code) -{ - __s32 unit_exponent = field->unit_exponent; - __s32 logical_extents = field->logical_maximum - - field->logical_minimum; - __s32 physical_extents = field->physical_maximum - - field->physical_minimum; - __s32 prev; - - /* Check if the extents are sane */ - if (logical_extents <= 0 || physical_extents <= 0) - return 0; - - /* - * Verify and convert units. - * See HID specification v1.11 6.2.2.7 Global Items for unit decoding - */ - if (code == ABS_X || code == ABS_Y || code == ABS_Z) { - if (field->unit == 0x11) { /* If centimeters */ - /* Convert to inches */ - prev = logical_extents; - logical_extents *= 254; - if (logical_extents < prev) - return 0; - unit_exponent += 2; - } else if (field->unit != 0x13) { /* If not inches */ - return 0; - } - } else if (code == ABS_RX || code == ABS_RY || code == ABS_RZ) { - if (field->unit == 0x14) { /* If degrees */ - /* Convert to radians */ - prev = logical_extents; - logical_extents *= 573; - if (logical_extents < prev) - return 0; - unit_exponent += 1; - } else if (field->unit != 0x12) { /* If not radians */ - return 0; - } - } else { - return 0; - } - - /* Apply negative unit exponent */ - for (; unit_exponent < 0; unit_exponent++) { - prev = logical_extents; - logical_extents *= 10; - if (logical_extents < prev) - return 0; - } - /* Apply positive unit exponent */ - for (; unit_exponent > 0; unit_exponent--) { - prev = physical_extents; - physical_extents *= 10; - if (physical_extents < prev) - return 0; - } - - /* Calculate resolution */ - return logical_extents / physical_extents; -} - static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_field *field, struct hid_usage *usage) { @@ -413,10 +336,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel map_key_clear(BTN_STYLUS); break; - case 0x46: /* TabletPick */ - map_key_clear(BTN_STYLUS2); - break; - default: goto unknown; } break; @@ -618,9 +537,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); else input_set_abs_params(input, usage->code, a, b, 0, 0); - input_abs_set_res(input, usage->code, - hidinput_calc_abs_res(field, usage->code)); - /* use a larger default input buffer for MT devices */ if (usage->code == ABS_MT_POSITION_X && input->hint_events_per_packet == 0) input_set_events_per_packet(input, 60); @@ -743,9 +659,6 @@ void hidinput_report_event(struct hid_device *hid, struct hid_report *report) { struct hid_input *hidinput; - if (hid->quirks & HID_QUIRK_NO_INPUT_SYNC) - return; - list_for_each_entry(hidinput, &hid->inputs, list) input_sync(hidinput->input); } diff --git a/trunk/drivers/hid/hid-kye.c b/trunk/drivers/hid/hid-kye.c index 817247ee006c..f8871712b7b5 100644 --- a/trunk/drivers/hid/hid-kye.c +++ b/trunk/drivers/hid/hid-kye.c @@ -23,10 +23,10 @@ * - report size 8 count 1 must be size 1 count 8 for button bitfield * - change the button usage range to 4-7 for the extra buttons */ -static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { - if (*rsize >= 74 && + if (rsize >= 74 && rdesc[61] == 0x05 && rdesc[62] == 0x08 && rdesc[63] == 0x19 && rdesc[64] == 0x08 && rdesc[65] == 0x29 && rdesc[66] == 0x0f && @@ -40,7 +40,6 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, rdesc[72] = 0x01; rdesc[74] = 0x08; } - return rdesc; } static const struct hid_device_id kye_devices[] = { diff --git a/trunk/drivers/hid/hid-lg.c b/trunk/drivers/hid/hid-lg.c index b629fba5a057..f6433d8050a9 100644 --- a/trunk/drivers/hid/hid-lg.c +++ b/trunk/drivers/hid/hid-lg.c @@ -7,7 +7,6 @@ * Copyright (c) 2006-2007 Jiri Kosina * Copyright (c) 2007 Paul Walmsley * Copyright (c) 2008 Jiri Slaby - * Copyright (c) 2010 Hendrik Iben */ /* @@ -20,9 +19,6 @@ #include #include #include -#include -#include -#include #include "hid-ids.h" #include "hid-lg.h" @@ -39,43 +35,31 @@ #define LG_FF2 0x400 #define LG_RDESC_REL_ABS 0x800 #define LG_FF3 0x1000 -#define LG_FF4 0x2000 /* * Certain Logitech keyboards send in report #3 keys which are far * above the logical maximum described in descriptor. This extends * the original value of 0x28c of logical maximum to 0x104d */ -static __u8 *lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void lg_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); - if ((quirks & LG_RDESC) && *rsize >= 90 && rdesc[83] == 0x26 && + if ((quirks & LG_RDESC) && rsize >= 90 && rdesc[83] == 0x26 && rdesc[84] == 0x8c && rdesc[85] == 0x02) { dev_info(&hdev->dev, "fixing up Logitech keyboard report " "descriptor\n"); rdesc[84] = rdesc[89] = 0x4d; rdesc[85] = rdesc[90] = 0x10; } - if ((quirks & LG_RDESC_REL_ABS) && *rsize >= 50 && + if ((quirks & LG_RDESC_REL_ABS) && rsize >= 50 && rdesc[32] == 0x81 && rdesc[33] == 0x06 && rdesc[49] == 0x81 && rdesc[50] == 0x06) { dev_info(&hdev->dev, "fixing up rel/abs in Logitech " "report descriptor\n"); rdesc[33] = rdesc[50] = 0x02; } - if ((quirks & LG_FF4) && *rsize >= 101 && - rdesc[41] == 0x95 && rdesc[42] == 0x0B && - rdesc[47] == 0x05 && rdesc[48] == 0x09) { - dev_info(&hdev->dev, "fixing up Logitech Speed Force Wireless " - "button descriptor\n"); - rdesc[41] = 0x05; - rdesc[42] = 0x09; - rdesc[47] = 0x95; - rdesc[48] = 0x0B; - } - return rdesc; } #define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ @@ -301,33 +285,12 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id) goto err_free; } - if (quirks & LG_FF4) { - unsigned char buf[] = { 0x00, 0xAF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - - ret = hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT); - - if (ret >= 0) { - /* insert a little delay of 10 jiffies ~ 40ms */ - wait_queue_head_t wait; - init_waitqueue_head (&wait); - wait_event_interruptible_timeout(wait, 0, 10); - - /* Select random Address */ - buf[1] = 0xB2; - get_random_bytes(&buf[2], 2); - - ret = hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT); - } - } - if (quirks & LG_FF) lgff_init(hdev); if (quirks & LG_FF2) lg2ff_init(hdev); if (quirks & LG_FF3) lg3ff_init(hdev); - if (quirks & LG_FF4) - lg4ff_init(hdev); return 0; err_free: @@ -362,8 +325,6 @@ static const struct hid_device_id lg_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL), .driver_data = LG_NOGET | LG_FF }, - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD), - .driver_data = LG_FF2 }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD), .driver_data = LG_FF }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2), @@ -378,8 +339,6 @@ static const struct hid_device_id lg_devices[] = { .driver_data = LG_FF }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G25_WHEEL), .driver_data = LG_FF }, - { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WII_WHEEL), - .driver_data = LG_FF4 }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_FFG ), .driver_data = LG_FF }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2), diff --git a/trunk/drivers/hid/hid-lg.h b/trunk/drivers/hid/hid-lg.h index b0100ba2ae0b..ce2ac8672624 100644 --- a/trunk/drivers/hid/hid-lg.h +++ b/trunk/drivers/hid/hid-lg.h @@ -19,10 +19,4 @@ int lg3ff_init(struct hid_device *hdev); static inline int lg3ff_init(struct hid_device *hdev) { return -1; } #endif -#ifdef CONFIG_LOGIWII_FF -int lg4ff_init(struct hid_device *hdev); -#else -static inline int lg4ff_init(struct hid_device *hdev) { return -1; } -#endif - #endif diff --git a/trunk/drivers/hid/hid-lg2ff.c b/trunk/drivers/hid/hid-lg2ff.c index 4258253c36b3..d888f1e6794f 100644 --- a/trunk/drivers/hid/hid-lg2ff.c +++ b/trunk/drivers/hid/hid-lg2ff.c @@ -1,5 +1,5 @@ /* - * Force feedback support for Logitech RumblePad and Rumblepad 2 + * Force feedback support for Logitech Rumblepad 2 * * Copyright (c) 2008 Anssi Hannula */ @@ -110,7 +110,7 @@ int lg2ff_init(struct hid_device *hid) usbhid_submit_report(hid, report, USB_DIR_OUT); - dev_info(&hid->dev, "Force feedback for Logitech RumblePad/Rumblepad 2 by " + dev_info(&hid->dev, "Force feedback for Logitech Rumblepad 2 by " "Anssi Hannula \n"); return 0; diff --git a/trunk/drivers/hid/hid-lg4ff.c b/trunk/drivers/hid/hid-lg4ff.c deleted file mode 100644 index 7eef5a2ce948..000000000000 --- a/trunk/drivers/hid/hid-lg4ff.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Force feedback support for Logitech Speed Force Wireless - * - * http://wiibrew.org/wiki/Logitech_USB_steering_wheel - * - * Copyright (c) 2010 Simon Wood - */ - -/* - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include -#include -#include - -#include "usbhid/usbhid.h" -#include "hid-lg.h" - -struct lg4ff_device { - struct hid_report *report; -}; - -static const signed short ff4_wheel_ac[] = { - FF_CONSTANT, - FF_AUTOCENTER, - -1 -}; - -static int hid_lg4ff_play(struct input_dev *dev, void *data, - struct ff_effect *effect) -{ - struct hid_device *hid = input_get_drvdata(dev); - struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; - struct hid_report *report = list_entry(report_list->next, struct hid_report, list); - int x; - -#define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff - - switch (effect->type) { - case FF_CONSTANT: - x = effect->u.ramp.start_level + 0x80; /* 0x80 is no force */ - CLAMP(x); - report->field[0]->value[0] = 0x11; /* Slot 1 */ - report->field[0]->value[1] = 0x10; - report->field[0]->value[2] = x; - report->field[0]->value[3] = 0x00; - report->field[0]->value[4] = 0x00; - report->field[0]->value[5] = 0x08; - report->field[0]->value[6] = 0x00; - dbg_hid("Autocenter, x=0x%02X\n", x); - - usbhid_submit_report(hid, report, USB_DIR_OUT); - break; - } - return 0; -} - -static void hid_lg4ff_set_autocenter(struct input_dev *dev, u16 magnitude) -{ - struct hid_device *hid = input_get_drvdata(dev); - struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; - struct hid_report *report = list_entry(report_list->next, struct hid_report, list); - __s32 *value = report->field[0]->value; - - *value++ = 0xfe; - *value++ = 0x0d; - *value++ = 0x07; - *value++ = 0x07; - *value++ = (magnitude >> 8) & 0xff; - *value++ = 0x00; - *value = 0x00; - - usbhid_submit_report(hid, report, USB_DIR_OUT); -} - - -int lg4ff_init(struct hid_device *hid) -{ - struct hid_input *hidinput = list_entry(hid->inputs.next, struct hid_input, list); - struct list_head *report_list = &hid->report_enum[HID_OUTPUT_REPORT].report_list; - struct input_dev *dev = hidinput->input; - struct hid_report *report; - struct hid_field *field; - const signed short *ff_bits = ff4_wheel_ac; - int error; - int i; - - /* Find the report to use */ - if (list_empty(report_list)) { - err_hid("No output report found"); - return -1; - } - - /* Check that the report looks ok */ - report = list_entry(report_list->next, struct hid_report, list); - if (!report) { - err_hid("NULL output report"); - return -1; - } - - field = report->field[0]; - if (!field) { - err_hid("NULL field"); - return -1; - } - - for (i = 0; ff_bits[i] >= 0; i++) - set_bit(ff_bits[i], dev->ffbit); - - error = input_ff_create_memless(dev, NULL, hid_lg4ff_play); - - if (error) - return error; - - if (test_bit(FF_AUTOCENTER, dev->ffbit)) - dev->ff->set_autocenter = hid_lg4ff_set_autocenter; - - dev_info(&hid->dev, "Force feedback for Logitech Speed Force Wireless by " - "Simon Wood \n"); - return 0; -} - diff --git a/trunk/drivers/hid/hid-magicmouse.c b/trunk/drivers/hid/hid-magicmouse.c index e6dc15171664..319b0e57ee41 100644 --- a/trunk/drivers/hid/hid-magicmouse.c +++ b/trunk/drivers/hid/hid-magicmouse.c @@ -2,7 +2,6 @@ * Apple "Magic" Wireless Mouse driver * * Copyright (c) 2010 Michael Poole - * Copyright (c) 2010 Chase Douglas */ /* @@ -54,9 +53,7 @@ static bool report_undeciphered; module_param(report_undeciphered, bool, 0644); MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state field using a MSC_RAW event"); -#define TRACKPAD_REPORT_ID 0x28 -#define MOUSE_REPORT_ID 0x29 -#define DOUBLE_REPORT_ID 0xf7 +#define TOUCH_REPORT_ID 0x29 /* These definitions are not precise, but they're close enough. (Bits * 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem * to be some kind of bit mask -- 0x20 may be a near-field reading, @@ -70,19 +67,15 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie #define SCROLL_ACCEL_DEFAULT 7 -/* Single touch emulation should only begin when no touches are currently down. - * This is true when single_touch_id is equal to NO_TOUCHES. If multiple touches - * are down and the touch providing for single touch emulation is lifted, - * single_touch_id is equal to SINGLE_TOUCH_UP. While single touch emulation is - * occuring, single_touch_id corresponds with the tracking id of the touch used. - */ -#define NO_TOUCHES -1 -#define SINGLE_TOUCH_UP -2 - /** * struct magicmouse_sc - Tracks Magic Mouse-specific data. * @input: Input device through which we report events. * @quirks: Currently unused. + * @last_timestamp: Timestamp from most recent (18-bit) touch report + * (units of milliseconds over short windows, but seems to + * increase faster when there are no touches). + * @delta_time: 18-bit difference between the two most recent touch + * reports from the mouse. * @ntouches: Number of touches in most recent touch report. * @scroll_accel: Number of consecutive scroll motions. * @scroll_jiffies: Time of last scroll motion. @@ -93,6 +86,8 @@ struct magicmouse_sc { struct input_dev *input; unsigned long quirks; + int last_timestamp; + int delta_time; int ntouches; int scroll_accel; unsigned long scroll_jiffies; @@ -103,9 +98,9 @@ struct magicmouse_sc { short scroll_x; short scroll_y; u8 size; + u8 down; } touches[16]; int tracking_ids[16]; - int single_touch_id; }; static int magicmouse_firm_touch(struct magicmouse_sc *msc) @@ -171,35 +166,18 @@ static void magicmouse_emit_buttons(struct magicmouse_sc *msc, int state) static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tdata) { struct input_dev *input = msc->input; - int id, x, y, size, orientation, touch_major, touch_minor, state, down; - - if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { - id = (tdata[6] << 2 | tdata[5] >> 6) & 0xf; - x = (tdata[1] << 28 | tdata[0] << 20) >> 20; - y = -((tdata[2] << 24 | tdata[1] << 16) >> 20); - size = tdata[5] & 0x3f; - orientation = (tdata[6] >> 2) - 32; - touch_major = tdata[3]; - touch_minor = tdata[4]; - state = tdata[7] & TOUCH_STATE_MASK; - down = state != TOUCH_STATE_NONE; - } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ - id = (tdata[7] << 2 | tdata[6] >> 6) & 0xf; - x = (tdata[1] << 27 | tdata[0] << 19) >> 19; - y = -((tdata[3] << 30 | tdata[2] << 22 | tdata[1] << 14) >> 19); - size = tdata[6] & 0x3f; - orientation = (tdata[7] >> 2) - 32; - touch_major = tdata[4]; - touch_minor = tdata[5]; - state = tdata[8] & TOUCH_STATE_MASK; - down = state != TOUCH_STATE_NONE; - } + __s32 x_y = tdata[0] << 8 | tdata[1] << 16 | tdata[2] << 24; + int misc = tdata[5] | tdata[6] << 8; + int id = (misc >> 6) & 15; + int x = x_y << 12 >> 20; + int y = -(x_y >> 20); + int down = (tdata[7] & TOUCH_STATE_MASK) != TOUCH_STATE_NONE; /* Store tracking ID and other fields. */ msc->tracking_ids[raw_id] = id; msc->touches[id].x = x; msc->touches[id].y = y; - msc->touches[id].size = size; + msc->touches[id].size = misc & 63; /* If requested, emulate a scroll wheel by detecting small * vertical touch motions. @@ -210,7 +188,7 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda int step_y = msc->touches[id].scroll_y - y; /* Calculate and apply the scroll motion. */ - switch (state) { + switch (tdata[7] & TOUCH_STATE_MASK) { case TOUCH_STATE_START: msc->touches[id].scroll_x = x; msc->touches[id].scroll_y = y; @@ -244,28 +222,21 @@ static void magicmouse_emit_touch(struct magicmouse_sc *msc, int raw_id, u8 *tda } } - if (down) { - msc->ntouches++; - if (msc->single_touch_id == NO_TOUCHES) - msc->single_touch_id = id; - } else if (msc->single_touch_id == id) - msc->single_touch_id = SINGLE_TOUCH_UP; - /* Generate the input events for this touch. */ if (report_touches && down) { + int orientation = (misc >> 10) - 32; + + msc->touches[id].down = 1; + input_report_abs(input, ABS_MT_TRACKING_ID, id); - input_report_abs(input, ABS_MT_TOUCH_MAJOR, touch_major << 2); - input_report_abs(input, ABS_MT_TOUCH_MINOR, touch_minor << 2); + input_report_abs(input, ABS_MT_TOUCH_MAJOR, tdata[3]); + input_report_abs(input, ABS_MT_TOUCH_MINOR, tdata[4]); input_report_abs(input, ABS_MT_ORIENTATION, orientation); input_report_abs(input, ABS_MT_POSITION_X, x); input_report_abs(input, ABS_MT_POSITION_Y, y); - if (report_undeciphered) { - if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) - input_event(input, EV_MSC, MSC_RAW, tdata[7]); - else /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ - input_event(input, EV_MSC, MSC_RAW, tdata[8]); - } + if (report_undeciphered) + input_event(input, EV_MSC, MSC_RAW, tdata[7]); input_mt_sync(input); } @@ -276,43 +247,39 @@ static int magicmouse_raw_event(struct hid_device *hdev, { struct magicmouse_sc *msc = hid_get_drvdata(hdev); struct input_dev *input = msc->input; - int x = 0, y = 0, ii, clicks = 0, npoints; + int x, y, ts, ii, clicks, last_up; switch (data[0]) { - case TRACKPAD_REPORT_ID: - /* Expect four bytes of prefix, and N*9 bytes of touch data. */ - if (size < 4 || ((size - 4) % 9) != 0) + case 0x10: + if (size != 6) return 0; - npoints = (size - 4) / 9; - msc->ntouches = 0; - for (ii = 0; ii < npoints; ii++) - magicmouse_emit_touch(msc, ii, data + ii * 9 + 4); - - /* We don't need an MT sync here because trackpad emits a - * BTN_TOUCH event in a new frame when all touches are released. - */ - if (msc->ntouches == 0) - msc->single_touch_id = NO_TOUCHES; - + x = (__s16)(data[2] | data[3] << 8); + y = (__s16)(data[4] | data[5] << 8); clicks = data[1]; - - /* The following bits provide a device specific timestamp. They - * are unused here. - * - * ts = data[1] >> 6 | data[2] << 2 | data[3] << 10; - */ break; - case MOUSE_REPORT_ID: + case TOUCH_REPORT_ID: /* Expect six bytes of prefix, and N*8 bytes of touch data. */ if (size < 6 || ((size - 6) % 8) != 0) return 0; - npoints = (size - 6) / 8; - msc->ntouches = 0; - for (ii = 0; ii < npoints; ii++) + ts = data[3] >> 6 | data[4] << 2 | data[5] << 10; + msc->delta_time = (ts - msc->last_timestamp) & 0x3ffff; + msc->last_timestamp = ts; + msc->ntouches = (size - 6) / 8; + for (ii = 0; ii < msc->ntouches; ii++) magicmouse_emit_touch(msc, ii, data + ii * 8 + 6); - if (report_touches && msc->ntouches == 0) - input_mt_sync(input); + if (report_touches) { + last_up = 1; + for (ii = 0; ii < ARRAY_SIZE(msc->touches); ii++) { + if (msc->touches[ii].down) { + last_up = 0; + msc->touches[ii].down = 0; + } + } + if (last_up) { + input_mt_sync(input); + } + } /* When emulating three-button mode, it is important * to have the current touch information before @@ -321,72 +288,68 @@ static int magicmouse_raw_event(struct hid_device *hdev, x = (int)(((data[3] & 0x0c) << 28) | (data[1] << 22)) >> 22; y = (int)(((data[3] & 0x30) << 26) | (data[2] << 22)) >> 22; clicks = data[3]; - - /* The following bits provide a device specific timestamp. They - * are unused here. - * - * ts = data[3] >> 6 | data[4] << 2 | data[5] << 10; - */ - break; - case DOUBLE_REPORT_ID: - /* Sometimes the trackpad sends two touch reports in one - * packet. - */ - magicmouse_raw_event(hdev, report, data + 2, data[1]); - magicmouse_raw_event(hdev, report, data + 2 + data[1], - size - 2 - data[1]); break; + case 0x20: /* Theoretically battery status (0-100), but I have + * never seen it -- maybe it is only upon request. + */ + case 0x60: /* Unknown, maybe laser on/off. */ + case 0x61: /* Laser reflection status change. + * data[1]: 0 = spotted, 1 = lost + */ default: return 0; } - if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { - magicmouse_emit_buttons(msc, clicks & 3); - input_report_rel(input, REL_X, x); - input_report_rel(input, REL_Y, y); - } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ - input_report_key(input, BTN_MOUSE, clicks & 1); - input_report_key(input, BTN_TOUCH, msc->ntouches > 0); - input_report_key(input, BTN_TOOL_FINGER, msc->ntouches == 1); - input_report_key(input, BTN_TOOL_DOUBLETAP, msc->ntouches == 2); - input_report_key(input, BTN_TOOL_TRIPLETAP, msc->ntouches == 3); - input_report_key(input, BTN_TOOL_QUADTAP, msc->ntouches == 4); - if (msc->single_touch_id >= 0) { - input_report_abs(input, ABS_X, - msc->touches[msc->single_touch_id].x); - input_report_abs(input, ABS_Y, - msc->touches[msc->single_touch_id].y); - } - } - + magicmouse_emit_buttons(msc, clicks & 3); + input_report_rel(input, REL_X, x); + input_report_rel(input, REL_Y, y); input_sync(input); return 1; } +static int magicmouse_input_open(struct input_dev *dev) +{ + struct hid_device *hid = input_get_drvdata(dev); + + return hid->ll_driver->open(hid); +} + +static void magicmouse_input_close(struct input_dev *dev) +{ + struct hid_device *hid = input_get_drvdata(dev); + + hid->ll_driver->close(hid); +} + static void magicmouse_setup_input(struct input_dev *input, struct hid_device *hdev) { - __set_bit(EV_KEY, input->evbit); + input_set_drvdata(input, hdev); + input->event = hdev->ll_driver->hidinput_input_event; + input->open = magicmouse_input_open; + input->close = magicmouse_input_close; + + input->name = hdev->name; + input->phys = hdev->phys; + input->uniq = hdev->uniq; + input->id.bustype = hdev->bus; + input->id.vendor = hdev->vendor; + input->id.product = hdev->product; + input->id.version = hdev->version; + input->dev.parent = hdev->dev.parent; - if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { - __set_bit(BTN_LEFT, input->keybit); - __set_bit(BTN_RIGHT, input->keybit); - if (emulate_3button) - __set_bit(BTN_MIDDLE, input->keybit); - - __set_bit(EV_REL, input->evbit); - __set_bit(REL_X, input->relbit); - __set_bit(REL_Y, input->relbit); - if (emulate_scroll_wheel) { - __set_bit(REL_WHEEL, input->relbit); - __set_bit(REL_HWHEEL, input->relbit); - } - } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ - __set_bit(BTN_MOUSE, input->keybit); - __set_bit(BTN_TOOL_FINGER, input->keybit); - __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); - __set_bit(BTN_TOOL_TRIPLETAP, input->keybit); - __set_bit(BTN_TOOL_QUADTAP, input->keybit); - __set_bit(BTN_TOUCH, input->keybit); + __set_bit(EV_KEY, input->evbit); + __set_bit(BTN_LEFT, input->keybit); + __set_bit(BTN_RIGHT, input->keybit); + if (emulate_3button) + __set_bit(BTN_MIDDLE, input->keybit); + __set_bit(BTN_TOOL_FINGER, input->keybit); + + __set_bit(EV_REL, input->evbit); + __set_bit(REL_X, input->relbit); + __set_bit(REL_Y, input->relbit); + if (emulate_scroll_wheel) { + __set_bit(REL_WHEEL, input->relbit); + __set_bit(REL_HWHEEL, input->relbit); } if (report_touches) { @@ -396,26 +359,16 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255, 4, 0); input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255, 4, 0); input_set_abs_params(input, ABS_MT_ORIENTATION, -32, 31, 1, 0); - + input_set_abs_params(input, ABS_MT_POSITION_X, -1100, 1358, + 4, 0); /* Note: Touch Y position from the device is inverted relative * to how pointer motion is reported (and relative to how USB * HID recommends the coordinates work). This driver keeps * the origin at the same position, and just uses the additive * inverse of the reported Y. */ - if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) { - input_set_abs_params(input, ABS_MT_POSITION_X, -1100, - 1358, 4, 0); - input_set_abs_params(input, ABS_MT_POSITION_Y, -1589, - 2047, 4, 0); - } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ - input_set_abs_params(input, ABS_X, -2909, 3167, 4, 0); - input_set_abs_params(input, ABS_Y, -2456, 2565, 4, 0); - input_set_abs_params(input, ABS_MT_POSITION_X, -2909, - 3167, 4, 0); - input_set_abs_params(input, ABS_MT_POSITION_Y, -2456, - 2565, 4, 0); - } + input_set_abs_params(input, ABS_MT_POSITION_Y, -1589, 2047, + 4, 0); } if (report_undeciphered) { @@ -424,22 +377,12 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h } } -static int magicmouse_input_mapping(struct hid_device *hdev, - struct hid_input *hi, struct hid_field *field, - struct hid_usage *usage, unsigned long **bit, int *max) -{ - struct magicmouse_sc *msc = hid_get_drvdata(hdev); - - if (!msc->input) - msc->input = hi->input; - - return 0; -} - static int magicmouse_probe(struct hid_device *hdev, const struct hid_device_id *id) { - __u8 feature[] = { 0xd7, 0x01 }; + __u8 feature_1[] = { 0xd7, 0x01 }; + __u8 feature_2[] = { 0xf8, 0x01, 0x32 }; + struct input_dev *input; struct magicmouse_sc *msc; struct hid_report *report; int ret; @@ -455,8 +398,6 @@ static int magicmouse_probe(struct hid_device *hdev, msc->quirks = id->driver_data; hid_set_drvdata(hdev, msc); - msc->single_touch_id = NO_TOUCHES; - ret = hid_parse(hdev); if (ret) { dev_err(&hdev->dev, "magicmouse hid parse failed\n"); @@ -469,22 +410,10 @@ static int magicmouse_probe(struct hid_device *hdev, goto err_free; } - /* We do this after hid-input is done parsing reports so that - * hid-input uses the most natural button and axis IDs. - */ - if (msc->input) - magicmouse_setup_input(msc->input, hdev); - - if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE) - report = hid_register_report(hdev, HID_INPUT_REPORT, - MOUSE_REPORT_ID); - else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ - report = hid_register_report(hdev, HID_INPUT_REPORT, - TRACKPAD_REPORT_ID); - report = hid_register_report(hdev, HID_INPUT_REPORT, - DOUBLE_REPORT_ID); - } + /* we are handling the input ourselves */ + hidinput_disconnect(hdev); + report = hid_register_report(hdev, HID_INPUT_REPORT, TOUCH_REPORT_ID); if (!report) { dev_err(&hdev->dev, "unable to register touch report\n"); ret = -ENOMEM; @@ -492,15 +421,39 @@ static int magicmouse_probe(struct hid_device *hdev, } report->size = 6; - ret = hdev->hid_output_raw_report(hdev, feature, sizeof(feature), + ret = hdev->hid_output_raw_report(hdev, feature_1, sizeof(feature_1), HID_FEATURE_REPORT); - if (ret != sizeof(feature)) { - dev_err(&hdev->dev, "unable to request touch data (%d)\n", + if (ret != sizeof(feature_1)) { + dev_err(&hdev->dev, "unable to request touch data (1:%d)\n", + ret); + goto err_stop_hw; + } + ret = hdev->hid_output_raw_report(hdev, feature_2, + sizeof(feature_2), HID_FEATURE_REPORT); + if (ret != sizeof(feature_2)) { + dev_err(&hdev->dev, "unable to request touch data (2:%d)\n", ret); goto err_stop_hw; } + input = input_allocate_device(); + if (!input) { + dev_err(&hdev->dev, "can't alloc input device\n"); + ret = -ENOMEM; + goto err_stop_hw; + } + magicmouse_setup_input(input, hdev); + + ret = input_register_device(input); + if (ret) { + dev_err(&hdev->dev, "input device registration failed\n"); + goto err_input; + } + msc->input = input; + return 0; +err_input: + input_free_device(input); err_stop_hw: hid_hw_stop(hdev); err_free: @@ -513,14 +466,13 @@ static void magicmouse_remove(struct hid_device *hdev) struct magicmouse_sc *msc = hid_get_drvdata(hdev); hid_hw_stop(hdev); + input_unregister_device(msc->input); kfree(msc); } static const struct hid_device_id magic_mice[] = { - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, - USB_DEVICE_ID_APPLE_MAGICMOUSE), .driver_data = 0 }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, - USB_DEVICE_ID_APPLE_MAGICTRACKPAD), .driver_data = 0 }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGICMOUSE), + .driver_data = 0 }, { } }; MODULE_DEVICE_TABLE(hid, magic_mice); @@ -531,7 +483,6 @@ static struct hid_driver magicmouse_driver = { .probe = magicmouse_probe, .remove = magicmouse_remove, .raw_event = magicmouse_raw_event, - .input_mapping = magicmouse_input_mapping, }; static int __init magicmouse_init(void) diff --git a/trunk/drivers/hid/hid-microsoft.c b/trunk/drivers/hid/hid-microsoft.c index dc618c33d0a2..359cc447c6c6 100644 --- a/trunk/drivers/hid/hid-microsoft.c +++ b/trunk/drivers/hid/hid-microsoft.c @@ -33,19 +33,18 @@ * Microsoft Wireless Desktop Receiver (Model 1028) has * 'Usage Min/Max' where it ought to have 'Physical Min/Max' */ -static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); - if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 && + if ((quirks & MS_RDESC) && rsize == 571 && rdesc[557] == 0x19 && rdesc[559] == 0x29) { dev_info(&hdev->dev, "fixing up Microsoft Wireless Receiver " "Model 1028 report descriptor\n"); rdesc[557] = 0x35; rdesc[559] = 0x45; } - return rdesc; } #define ms_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ diff --git a/trunk/drivers/hid/hid-monterey.c b/trunk/drivers/hid/hid-monterey.c index c95c31e2d869..2cd05aa244b9 100644 --- a/trunk/drivers/hid/hid-monterey.c +++ b/trunk/drivers/hid/hid-monterey.c @@ -22,15 +22,14 @@ #include "hid-ids.h" -static __u8 *mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void mr_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { - if (*rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { + if (rsize >= 30 && rdesc[29] == 0x05 && rdesc[30] == 0x09) { dev_info(&hdev->dev, "fixing up button/consumer in HID report " "descriptor\n"); rdesc[30] = 0x0c; } - return rdesc; } #define mr_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ diff --git a/trunk/drivers/hid/hid-ntrig.c b/trunk/drivers/hid/hid-ntrig.c index 69169efa1e16..fb69b8c4953f 100644 --- a/trunk/drivers/hid/hid-ntrig.c +++ b/trunk/drivers/hid/hid-ntrig.c @@ -90,55 +90,6 @@ struct ntrig_data { }; -/* - * This function converts the 4 byte raw firmware code into - * a string containing 5 comma separated numbers. - */ -static int ntrig_version_string(unsigned char *raw, char *buf) -{ - __u8 a = (raw[1] & 0x0e) >> 1; - __u8 b = (raw[0] & 0x3c) >> 2; - __u8 c = ((raw[0] & 0x03) << 3) | ((raw[3] & 0xe0) >> 5); - __u8 d = ((raw[3] & 0x07) << 3) | ((raw[2] & 0xe0) >> 5); - __u8 e = raw[2] & 0x07; - - /* - * As yet unmapped bits: - * 0b11000000 0b11110001 0b00011000 0b00011000 - */ - - return sprintf(buf, "%u.%u.%u.%u.%u", a, b, c, d, e); -} - -static void ntrig_report_version(struct hid_device *hdev) -{ - int ret; - char buf[20]; - struct usb_device *usb_dev = hid_to_usb_dev(hdev); - unsigned char *data = kmalloc(8, GFP_KERNEL); - - if (!data) - goto err_free; - - ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), - USB_REQ_CLEAR_FEATURE, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | - USB_DIR_IN, - 0x30c, 1, data, 8, - USB_CTRL_SET_TIMEOUT); - - if (ret == 8) { - ret = ntrig_version_string(&data[2], buf); - - dev_info(&hdev->dev, - "Firmware version: %s (%02x%02x %02x%02x)\n", - buf, data[2], data[3], data[4], data[5]); - } - -err_free: - kfree(data); -} - static ssize_t show_phys_width(struct device *dev, struct device_attribute *attr, char *buf) @@ -426,8 +377,8 @@ static struct attribute_group ntrig_attribute_group = { */ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi, - struct hid_field *field, struct hid_usage *usage, - unsigned long **bit, int *max) + struct hid_field *field, struct hid_usage *usage, + unsigned long **bit, int *max) { struct ntrig_data *nd = hid_get_drvdata(hdev); @@ -497,13 +448,13 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi, /* width/height mapped on TouchMajor/TouchMinor/Orientation */ case HID_DG_WIDTH: hid_map_usage(hi, usage, bit, max, - EV_ABS, ABS_MT_TOUCH_MAJOR); + EV_ABS, ABS_MT_TOUCH_MAJOR); return 1; case HID_DG_HEIGHT: hid_map_usage(hi, usage, bit, max, - EV_ABS, ABS_MT_TOUCH_MINOR); + EV_ABS, ABS_MT_TOUCH_MINOR); input_set_abs_params(hi->input, ABS_MT_ORIENTATION, - 0, 1, 0, 0); + 0, 1, 0, 0); return 1; } return 0; @@ -517,8 +468,8 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi, } static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi, - struct hid_field *field, struct hid_usage *usage, - unsigned long **bit, int *max) + struct hid_field *field, struct hid_usage *usage, + unsigned long **bit, int *max) { /* No special mappings needed for the pen and single touch */ if (field->physical) @@ -538,7 +489,7 @@ static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi, * and call input_mt_sync after each point if necessary */ static int ntrig_event (struct hid_device *hid, struct hid_field *field, - struct hid_usage *usage, __s32 value) + struct hid_usage *usage, __s32 value) { struct input_dev *input = field->hidinput->input; struct ntrig_data *nd = hid_get_drvdata(hid); @@ -897,8 +848,6 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) if (report) usbhid_submit_report(hdev, report, USB_DIR_OUT); - ntrig_report_version(hdev); - ret = sysfs_create_group(&hdev->dev.kobj, &ntrig_attribute_group); @@ -911,7 +860,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id) static void ntrig_remove(struct hid_device *hdev) { sysfs_remove_group(&hdev->dev.kobj, - &ntrig_attribute_group); + &ntrig_attribute_group); hid_hw_stop(hdev); kfree(hid_get_drvdata(hdev)); } diff --git a/trunk/drivers/hid/hid-ortek.c b/trunk/drivers/hid/hid-ortek.c index 2e79716dca31..aa9a960f73a4 100644 --- a/trunk/drivers/hid/hid-ortek.c +++ b/trunk/drivers/hid/hid-ortek.c @@ -19,15 +19,14 @@ #include "hid-ids.h" -static __u8 *ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void ortek_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { - if (*rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { + if (rsize >= 56 && rdesc[54] == 0x25 && rdesc[55] == 0x01) { dev_info(&hdev->dev, "Fixing up Ortek WKB-2000 " "report descriptor.\n"); rdesc[55] = 0x92; } - return rdesc; } static const struct hid_device_id ortek_devices[] = { diff --git a/trunk/drivers/hid/hid-petalynx.c b/trunk/drivers/hid/hid-petalynx.c index 308d6ae48a3e..500fbd0652dc 100644 --- a/trunk/drivers/hid/hid-petalynx.c +++ b/trunk/drivers/hid/hid-petalynx.c @@ -23,10 +23,10 @@ #include "hid-ids.h" /* Petalynx Maxter Remote has maximum for consumer page set too low */ -static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { - if (*rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && + if (rsize >= 60 && rdesc[39] == 0x2a && rdesc[40] == 0xf5 && rdesc[41] == 0x00 && rdesc[59] == 0x26 && rdesc[60] == 0xf9 && rdesc[61] == 0x00) { dev_info(&hdev->dev, "fixing up Petalynx Maxter Remote report " @@ -34,7 +34,6 @@ static __u8 *pl_report_fixup(struct hid_device *hdev, __u8 *rdesc, rdesc[60] = 0xfa; rdesc[40] = 0xfa; } - return rdesc; } #define pl_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ diff --git a/trunk/drivers/hid/hid-prodikeys.c b/trunk/drivers/hid/hid-prodikeys.c index 48eab84f53b5..845f428b8090 100644 --- a/trunk/drivers/hid/hid-prodikeys.c +++ b/trunk/drivers/hid/hid-prodikeys.c @@ -740,10 +740,10 @@ int pcmidi_snd_terminate(struct pcmidi_snd *pm) /* * PC-MIDI report descriptor for report id is wrong. */ -static __u8 *pk_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void pk_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { - if (*rsize == 178 && + if (rsize == 178 && rdesc[111] == 0x06 && rdesc[112] == 0x00 && rdesc[113] == 0xff) { dev_info(&hdev->dev, "fixing up pc-midi keyboard report " @@ -751,7 +751,6 @@ static __u8 *pk_report_fixup(struct hid_device *hdev, __u8 *rdesc, rdesc[144] = 0x18; /* report 4: was 0x10 report count */ } - return rdesc; } static int pk_input_mapping(struct hid_device *hdev, struct hid_input *hi, diff --git a/trunk/drivers/hid/hid-roccat-pyra.c b/trunk/drivers/hid/hid-roccat-pyra.c deleted file mode 100644 index 9bf23047892a..000000000000 --- a/trunk/drivers/hid/hid-roccat-pyra.c +++ /dev/null @@ -1,968 +0,0 @@ -/* - * Roccat Pyra driver for Linux - * - * Copyright (c) 2010 Stefan Achatz - */ - -/* - * 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. - */ - -/* - * Roccat Pyra is a mobile gamer mouse which comes in wired and wireless - * variant. Wireless variant is not tested. - * Userland tools can be found at http://sourceforge.net/projects/roccat - */ - -#include -#include -#include -#include -#include -#include -#include "hid-ids.h" -#include "hid-roccat.h" -#include "hid-roccat-pyra.h" - -static void profile_activated(struct pyra_device *pyra, - unsigned int new_profile) -{ - pyra->actual_profile = new_profile; - pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; -} - -static int pyra_send_control(struct usb_device *usb_dev, int value, - enum pyra_control_requests request) -{ - int len; - struct pyra_control control; - - if ((request == PYRA_CONTROL_REQUEST_PROFILE_SETTINGS || - request == PYRA_CONTROL_REQUEST_PROFILE_BUTTONS) && - (value < 0 || value > 4)) - return -EINVAL; - - control.command = PYRA_COMMAND_CONTROL; - control.value = value; - control.request = request; - - len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0), - USB_REQ_SET_CONFIGURATION, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, - PYRA_USB_COMMAND_CONTROL, 0, (char *)&control, - sizeof(struct pyra_control), - USB_CTRL_SET_TIMEOUT); - - if (len != sizeof(struct pyra_control)) - return len; - - return 0; -} - -static int pyra_receive_control_status(struct usb_device *usb_dev) -{ - int len; - struct pyra_control control; - - do { - msleep(10); - - len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), - USB_REQ_CLEAR_FEATURE, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | - USB_DIR_IN, - PYRA_USB_COMMAND_CONTROL, 0, (char *)&control, - sizeof(struct pyra_control), - USB_CTRL_SET_TIMEOUT); - - /* requested too early, try again */ - } while (len == -EPROTO); - - if (len == sizeof(struct pyra_control) && - control.command == PYRA_COMMAND_CONTROL && - control.request == PYRA_CONTROL_REQUEST_STATUS && - control.value == 1) - return 0; - else { - dev_err(&usb_dev->dev, "receive control status: " - "unknown response 0x%x 0x%x\n", - control.request, control.value); - return -EINVAL; - } -} - -static int pyra_get_profile_settings(struct usb_device *usb_dev, - struct pyra_profile_settings *buf, int number) -{ - int retval; - - retval = pyra_send_control(usb_dev, number, - PYRA_CONTROL_REQUEST_PROFILE_SETTINGS); - - if (retval) - return retval; - - retval = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), - USB_REQ_CLEAR_FEATURE, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, - PYRA_USB_COMMAND_PROFILE_SETTINGS, 0, (char *)buf, - sizeof(struct pyra_profile_settings), - USB_CTRL_SET_TIMEOUT); - - if (retval != sizeof(struct pyra_profile_settings)) - return retval; - - return 0; -} - -static int pyra_get_profile_buttons(struct usb_device *usb_dev, - struct pyra_profile_buttons *buf, int number) -{ - int retval; - - retval = pyra_send_control(usb_dev, number, - PYRA_CONTROL_REQUEST_PROFILE_BUTTONS); - - if (retval) - return retval; - - retval = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), - USB_REQ_CLEAR_FEATURE, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, - PYRA_USB_COMMAND_PROFILE_BUTTONS, 0, (char *)buf, - sizeof(struct pyra_profile_buttons), - USB_CTRL_SET_TIMEOUT); - - if (retval != sizeof(struct pyra_profile_buttons)) - return retval; - - return 0; -} - -static int pyra_get_settings(struct usb_device *usb_dev, - struct pyra_settings *buf) -{ - int len; - len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), - USB_REQ_CLEAR_FEATURE, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, - PYRA_USB_COMMAND_SETTINGS, 0, buf, - sizeof(struct pyra_settings), USB_CTRL_SET_TIMEOUT); - if (len != sizeof(struct pyra_settings)) - return -EIO; - return 0; -} - -static int pyra_get_info(struct usb_device *usb_dev, struct pyra_info *buf) -{ - int len; - len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), - USB_REQ_CLEAR_FEATURE, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, - PYRA_USB_COMMAND_INFO, 0, buf, - sizeof(struct pyra_info), USB_CTRL_SET_TIMEOUT); - if (len != sizeof(struct pyra_info)) - return -EIO; - return 0; -} - -static int pyra_set_profile_settings(struct usb_device *usb_dev, - struct pyra_profile_settings const *settings) -{ - int len; - len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0), - USB_REQ_SET_CONFIGURATION, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, - PYRA_USB_COMMAND_PROFILE_SETTINGS, 0, (char *)settings, - sizeof(struct pyra_profile_settings), - USB_CTRL_SET_TIMEOUT); - if (len != sizeof(struct pyra_profile_settings)) - return -EIO; - if (pyra_receive_control_status(usb_dev)) - return -EIO; - return 0; -} - -static int pyra_set_profile_buttons(struct usb_device *usb_dev, - struct pyra_profile_buttons const *buttons) -{ - int len; - len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0), - USB_REQ_SET_CONFIGURATION, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, - PYRA_USB_COMMAND_PROFILE_BUTTONS, 0, (char *)buttons, - sizeof(struct pyra_profile_buttons), - USB_CTRL_SET_TIMEOUT); - if (len != sizeof(struct pyra_profile_buttons)) - return -EIO; - if (pyra_receive_control_status(usb_dev)) - return -EIO; - return 0; -} - -static int pyra_set_settings(struct usb_device *usb_dev, - struct pyra_settings const *settings) -{ - int len; - len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0), - USB_REQ_SET_CONFIGURATION, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, - PYRA_USB_COMMAND_SETTINGS, 0, (char *)settings, - sizeof(struct pyra_settings), USB_CTRL_SET_TIMEOUT); - if (len != sizeof(struct pyra_settings)) - return -EIO; - if (pyra_receive_control_status(usb_dev)) - return -EIO; - return 0; -} - -static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count, int number) -{ - struct device *dev = container_of(kobj, struct device, kobj); - struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); - - if (off >= sizeof(struct pyra_profile_settings)) - return 0; - - if (off + count > sizeof(struct pyra_profile_settings)) - count = sizeof(struct pyra_profile_settings) - off; - - mutex_lock(&pyra->pyra_lock); - memcpy(buf, ((char const *)&pyra->profile_settings[number]) + off, - count); - mutex_unlock(&pyra->pyra_lock); - - return count; -} - -static ssize_t pyra_sysfs_read_profile1_settings(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return pyra_sysfs_read_profilex_settings(fp, kobj, - attr, buf, off, count, 0); -} - -static ssize_t pyra_sysfs_read_profile2_settings(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return pyra_sysfs_read_profilex_settings(fp, kobj, - attr, buf, off, count, 1); -} - -static ssize_t pyra_sysfs_read_profile3_settings(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return pyra_sysfs_read_profilex_settings(fp, kobj, - attr, buf, off, count, 2); -} - -static ssize_t pyra_sysfs_read_profile4_settings(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return pyra_sysfs_read_profilex_settings(fp, kobj, - attr, buf, off, count, 3); -} - -static ssize_t pyra_sysfs_read_profile5_settings(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return pyra_sysfs_read_profilex_settings(fp, kobj, - attr, buf, off, count, 4); -} - -static ssize_t pyra_sysfs_read_profilex_buttons(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count, int number) -{ - struct device *dev = container_of(kobj, struct device, kobj); - struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); - - if (off >= sizeof(struct pyra_profile_buttons)) - return 0; - - if (off + count > sizeof(struct pyra_profile_buttons)) - count = sizeof(struct pyra_profile_buttons) - off; - - mutex_lock(&pyra->pyra_lock); - memcpy(buf, ((char const *)&pyra->profile_buttons[number]) + off, - count); - mutex_unlock(&pyra->pyra_lock); - - return count; -} - -static ssize_t pyra_sysfs_read_profile1_buttons(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return pyra_sysfs_read_profilex_buttons(fp, kobj, - attr, buf, off, count, 0); -} - -static ssize_t pyra_sysfs_read_profile2_buttons(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return pyra_sysfs_read_profilex_buttons(fp, kobj, - attr, buf, off, count, 1); -} - -static ssize_t pyra_sysfs_read_profile3_buttons(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return pyra_sysfs_read_profilex_buttons(fp, kobj, - attr, buf, off, count, 2); -} - -static ssize_t pyra_sysfs_read_profile4_buttons(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return pyra_sysfs_read_profilex_buttons(fp, kobj, - attr, buf, off, count, 3); -} - -static ssize_t pyra_sysfs_read_profile5_buttons(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return pyra_sysfs_read_profilex_buttons(fp, kobj, - attr, buf, off, count, 4); -} - -static ssize_t pyra_sysfs_write_profile_settings(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - struct device *dev = container_of(kobj, struct device, kobj); - struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); - struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); - int retval = 0; - int difference; - int profile_number; - struct pyra_profile_settings *profile_settings; - - if (off != 0 || count != sizeof(struct pyra_profile_settings)) - return -EINVAL; - - profile_number = ((struct pyra_profile_settings const *)buf)->number; - profile_settings = &pyra->profile_settings[profile_number]; - - mutex_lock(&pyra->pyra_lock); - difference = memcmp(buf, profile_settings, - sizeof(struct pyra_profile_settings)); - if (difference) { - retval = pyra_set_profile_settings(usb_dev, - (struct pyra_profile_settings const *)buf); - if (!retval) - memcpy(profile_settings, buf, - sizeof(struct pyra_profile_settings)); - } - mutex_unlock(&pyra->pyra_lock); - - if (retval) - return retval; - - return sizeof(struct pyra_profile_settings); -} - -static ssize_t pyra_sysfs_write_profile_buttons(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - struct device *dev = container_of(kobj, struct device, kobj); - struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); - struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); - int retval = 0; - int difference; - int profile_number; - struct pyra_profile_buttons *profile_buttons; - - if (off != 0 || count != sizeof(struct pyra_profile_buttons)) - return -EINVAL; - - profile_number = ((struct pyra_profile_buttons const *)buf)->number; - profile_buttons = &pyra->profile_buttons[profile_number]; - - mutex_lock(&pyra->pyra_lock); - difference = memcmp(buf, profile_buttons, - sizeof(struct pyra_profile_buttons)); - if (difference) { - retval = pyra_set_profile_buttons(usb_dev, - (struct pyra_profile_buttons const *)buf); - if (!retval) - memcpy(profile_buttons, buf, - sizeof(struct pyra_profile_buttons)); - } - mutex_unlock(&pyra->pyra_lock); - - if (retval) - return retval; - - return sizeof(struct pyra_profile_buttons); -} - -static ssize_t pyra_sysfs_read_settings(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - struct device *dev = container_of(kobj, struct device, kobj); - struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); - - if (off >= sizeof(struct pyra_settings)) - return 0; - - if (off + count > sizeof(struct pyra_settings)) - count = sizeof(struct pyra_settings) - off; - - mutex_lock(&pyra->pyra_lock); - memcpy(buf, ((char const *)&pyra->settings) + off, count); - mutex_unlock(&pyra->pyra_lock); - - return count; -} - -static ssize_t pyra_sysfs_write_settings(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - struct device *dev = container_of(kobj, struct device, kobj); - struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); - struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); - int retval = 0; - int difference; - - if (off != 0 || count != sizeof(struct pyra_settings)) - return -EINVAL; - - mutex_lock(&pyra->pyra_lock); - difference = memcmp(buf, &pyra->settings, sizeof(struct pyra_settings)); - if (difference) { - retval = pyra_set_settings(usb_dev, - (struct pyra_settings const *)buf); - if (!retval) - memcpy(&pyra->settings, buf, - sizeof(struct pyra_settings)); - } - mutex_unlock(&pyra->pyra_lock); - - if (retval) - return retval; - - profile_activated(pyra, pyra->settings.startup_profile); - - return sizeof(struct pyra_settings); -} - - -static ssize_t pyra_sysfs_show_actual_cpi(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); - return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi); -} - -static ssize_t pyra_sysfs_show_actual_profile(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); - return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_profile); -} - -static ssize_t pyra_sysfs_show_firmware_version(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); - return snprintf(buf, PAGE_SIZE, "%d\n", pyra->firmware_version); -} - -static ssize_t pyra_sysfs_show_startup_profile(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct pyra_device *pyra = hid_get_drvdata(dev_get_drvdata(dev)); - return snprintf(buf, PAGE_SIZE, "%d\n", pyra->settings.startup_profile); -} - -static DEVICE_ATTR(actual_cpi, 0440, pyra_sysfs_show_actual_cpi, NULL); - -static DEVICE_ATTR(actual_profile, 0440, pyra_sysfs_show_actual_profile, NULL); - -static DEVICE_ATTR(firmware_version, 0440, - pyra_sysfs_show_firmware_version, NULL); - -static DEVICE_ATTR(startup_profile, 0440, - pyra_sysfs_show_startup_profile, NULL); - -static struct attribute *pyra_attributes[] = { - &dev_attr_actual_cpi.attr, - &dev_attr_actual_profile.attr, - &dev_attr_firmware_version.attr, - &dev_attr_startup_profile.attr, - NULL -}; - -static struct attribute_group pyra_attribute_group = { - .attrs = pyra_attributes -}; - -static struct bin_attribute pyra_profile_settings_attr = { - .attr = { .name = "profile_settings", .mode = 0220 }, - .size = sizeof(struct pyra_profile_settings), - .write = pyra_sysfs_write_profile_settings -}; - -static struct bin_attribute pyra_profile1_settings_attr = { - .attr = { .name = "profile1_settings", .mode = 0440 }, - .size = sizeof(struct pyra_profile_settings), - .read = pyra_sysfs_read_profile1_settings -}; - -static struct bin_attribute pyra_profile2_settings_attr = { - .attr = { .name = "profile2_settings", .mode = 0440 }, - .size = sizeof(struct pyra_profile_settings), - .read = pyra_sysfs_read_profile2_settings -}; - -static struct bin_attribute pyra_profile3_settings_attr = { - .attr = { .name = "profile3_settings", .mode = 0440 }, - .size = sizeof(struct pyra_profile_settings), - .read = pyra_sysfs_read_profile3_settings -}; - -static struct bin_attribute pyra_profile4_settings_attr = { - .attr = { .name = "profile4_settings", .mode = 0440 }, - .size = sizeof(struct pyra_profile_settings), - .read = pyra_sysfs_read_profile4_settings -}; - -static struct bin_attribute pyra_profile5_settings_attr = { - .attr = { .name = "profile5_settings", .mode = 0440 }, - .size = sizeof(struct pyra_profile_settings), - .read = pyra_sysfs_read_profile5_settings -}; - -static struct bin_attribute pyra_profile_buttons_attr = { - .attr = { .name = "profile_buttons", .mode = 0220 }, - .size = sizeof(struct pyra_profile_buttons), - .write = pyra_sysfs_write_profile_buttons -}; - -static struct bin_attribute pyra_profile1_buttons_attr = { - .attr = { .name = "profile1_buttons", .mode = 0440 }, - .size = sizeof(struct pyra_profile_buttons), - .read = pyra_sysfs_read_profile1_buttons -}; - -static struct bin_attribute pyra_profile2_buttons_attr = { - .attr = { .name = "profile2_buttons", .mode = 0440 }, - .size = sizeof(struct pyra_profile_buttons), - .read = pyra_sysfs_read_profile2_buttons -}; - -static struct bin_attribute pyra_profile3_buttons_attr = { - .attr = { .name = "profile3_buttons", .mode = 0440 }, - .size = sizeof(struct pyra_profile_buttons), - .read = pyra_sysfs_read_profile3_buttons -}; - -static struct bin_attribute pyra_profile4_buttons_attr = { - .attr = { .name = "profile4_buttons", .mode = 0440 }, - .size = sizeof(struct pyra_profile_buttons), - .read = pyra_sysfs_read_profile4_buttons -}; - -static struct bin_attribute pyra_profile5_buttons_attr = { - .attr = { .name = "profile5_buttons", .mode = 0440 }, - .size = sizeof(struct pyra_profile_buttons), - .read = pyra_sysfs_read_profile5_buttons -}; - -static struct bin_attribute pyra_settings_attr = { - .attr = { .name = "settings", .mode = 0660 }, - .size = sizeof(struct pyra_settings), - .read = pyra_sysfs_read_settings, - .write = pyra_sysfs_write_settings -}; - -static int pyra_create_sysfs_attributes(struct usb_interface *intf) -{ - int retval; - - retval = sysfs_create_group(&intf->dev.kobj, &pyra_attribute_group); - if (retval) - goto exit_1; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile_settings_attr); - if (retval) - goto exit_2; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile1_settings_attr); - if (retval) - goto exit_3; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile2_settings_attr); - if (retval) - goto exit_4; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile3_settings_attr); - if (retval) - goto exit_5; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile4_settings_attr); - if (retval) - goto exit_6; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile5_settings_attr); - if (retval) - goto exit_7; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile_buttons_attr); - if (retval) - goto exit_8; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile1_buttons_attr); - if (retval) - goto exit_9; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile2_buttons_attr); - if (retval) - goto exit_10; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile3_buttons_attr); - if (retval) - goto exit_11; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile4_buttons_attr); - if (retval) - goto exit_12; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_profile5_buttons_attr); - if (retval) - goto exit_13; - - retval = sysfs_create_bin_file(&intf->dev.kobj, - &pyra_settings_attr); - if (retval) - goto exit_14; - - return 0; - -exit_14: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile5_buttons_attr); -exit_13: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile4_buttons_attr); -exit_12: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile3_buttons_attr); -exit_11: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile2_buttons_attr); -exit_10: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile1_buttons_attr); -exit_9: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile_buttons_attr); -exit_8: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile5_settings_attr); -exit_7: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile4_settings_attr); -exit_6: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile3_settings_attr); -exit_5: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile2_settings_attr); -exit_4: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile1_settings_attr); -exit_3: - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile_settings_attr); -exit_2: - sysfs_remove_group(&intf->dev.kobj, &pyra_attribute_group); -exit_1: - return retval; -} - -static void pyra_remove_sysfs_attributes(struct usb_interface *intf) -{ - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile5_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile4_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile3_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile2_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile1_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile_buttons_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile5_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile4_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile3_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile2_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile1_settings_attr); - sysfs_remove_bin_file(&intf->dev.kobj, &pyra_profile_settings_attr); - sysfs_remove_group(&intf->dev.kobj, &pyra_attribute_group); -} - -static int pyra_init_pyra_device_struct(struct usb_device *usb_dev, - struct pyra_device *pyra) -{ - struct pyra_info *info; - int retval, i; - - mutex_init(&pyra->pyra_lock); - - info = kmalloc(sizeof(struct pyra_info), GFP_KERNEL); - if (!info) - return -ENOMEM; - retval = pyra_get_info(usb_dev, info); - if (retval) { - kfree(info); - return retval; - } - pyra->firmware_version = info->firmware_version; - kfree(info); - - retval = pyra_get_settings(usb_dev, &pyra->settings); - if (retval) - return retval; - - for (i = 0; i < 5; ++i) { - retval = pyra_get_profile_settings(usb_dev, - &pyra->profile_settings[i], i); - if (retval) - return retval; - - retval = pyra_get_profile_buttons(usb_dev, - &pyra->profile_buttons[i], i); - if (retval) - return retval; - } - - profile_activated(pyra, pyra->settings.startup_profile); - - return 0; -} - -static int pyra_init_specials(struct hid_device *hdev) -{ - struct usb_interface *intf = to_usb_interface(hdev->dev.parent); - struct usb_device *usb_dev = interface_to_usbdev(intf); - struct pyra_device *pyra; - int retval; - - if (intf->cur_altsetting->desc.bInterfaceProtocol - == USB_INTERFACE_PROTOCOL_MOUSE) { - - pyra = kzalloc(sizeof(*pyra), GFP_KERNEL); - if (!pyra) { - dev_err(&hdev->dev, "can't alloc device descriptor\n"); - return -ENOMEM; - } - hid_set_drvdata(hdev, pyra); - - retval = pyra_init_pyra_device_struct(usb_dev, pyra); - if (retval) { - dev_err(&hdev->dev, - "couldn't init struct pyra_device\n"); - goto exit_free; - } - - retval = roccat_connect(hdev); - if (retval < 0) { - dev_err(&hdev->dev, "couldn't init char dev\n"); - } else { - pyra->chrdev_minor = retval; - pyra->roccat_claimed = 1; - } - - retval = pyra_create_sysfs_attributes(intf); - if (retval) { - dev_err(&hdev->dev, "cannot create sysfs files\n"); - goto exit_free; - } - } else { - hid_set_drvdata(hdev, NULL); - } - - return 0; -exit_free: - kfree(pyra); - return retval; -} - -static void pyra_remove_specials(struct hid_device *hdev) -{ - struct usb_interface *intf = to_usb_interface(hdev->dev.parent); - struct pyra_device *pyra; - - if (intf->cur_altsetting->desc.bInterfaceProtocol - == USB_INTERFACE_PROTOCOL_MOUSE) { - pyra_remove_sysfs_attributes(intf); - pyra = hid_get_drvdata(hdev); - if (pyra->roccat_claimed) - roccat_disconnect(pyra->chrdev_minor); - kfree(hid_get_drvdata(hdev)); - } -} - -static int pyra_probe(struct hid_device *hdev, const struct hid_device_id *id) -{ - int retval; - - retval = hid_parse(hdev); - if (retval) { - dev_err(&hdev->dev, "parse failed\n"); - goto exit; - } - - retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); - if (retval) { - dev_err(&hdev->dev, "hw start failed\n"); - goto exit; - } - - retval = pyra_init_specials(hdev); - if (retval) { - dev_err(&hdev->dev, "couldn't install mouse\n"); - goto exit_stop; - } - return 0; - -exit_stop: - hid_hw_stop(hdev); -exit: - return retval; -} - -static void pyra_remove(struct hid_device *hdev) -{ - pyra_remove_specials(hdev); - hid_hw_stop(hdev); -} - -static void pyra_keep_values_up_to_date(struct pyra_device *pyra, - u8 const *data) -{ - struct pyra_mouse_event_button const *button_event; - - switch (data[0]) { - case PYRA_MOUSE_REPORT_NUMBER_BUTTON: - button_event = (struct pyra_mouse_event_button const *)data; - switch (button_event->type) { - case PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2: - profile_activated(pyra, button_event->data1 - 1); - break; - case PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI: - pyra->actual_cpi = button_event->data1; - break; - } - break; - } -} - -static void pyra_report_to_chrdev(struct pyra_device const *pyra, - u8 const *data) -{ - struct pyra_roccat_report roccat_report; - struct pyra_mouse_event_button const *button_event; - - if (data[0] != PYRA_MOUSE_REPORT_NUMBER_BUTTON) - return; - - button_event = (struct pyra_mouse_event_button const *)data; - - switch (button_event->type) { - case PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2: - case PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI: - roccat_report.type = button_event->type; - roccat_report.value = button_event->data1; - roccat_report.key = 0; - roccat_report_event(pyra->chrdev_minor, - (uint8_t const *)&roccat_report, - sizeof(struct pyra_roccat_report)); - break; - case PYRA_MOUSE_EVENT_BUTTON_TYPE_MACRO: - case PYRA_MOUSE_EVENT_BUTTON_TYPE_SHORTCUT: - case PYRA_MOUSE_EVENT_BUTTON_TYPE_QUICKLAUNCH: - if (button_event->data2 == PYRA_MOUSE_EVENT_BUTTON_PRESS) { - roccat_report.type = button_event->type; - roccat_report.key = button_event->data1; - /* - * pyra reports profile numbers with range 1-5. - * Keeping this behaviour. - */ - roccat_report.value = pyra->actual_profile + 1; - roccat_report_event(pyra->chrdev_minor, - (uint8_t const *)&roccat_report, - sizeof(struct pyra_roccat_report)); - } - break; - } -} - -static int pyra_raw_event(struct hid_device *hdev, struct hid_report *report, - u8 *data, int size) -{ - struct usb_interface *intf = to_usb_interface(hdev->dev.parent); - struct pyra_device *pyra = hid_get_drvdata(hdev); - - if (intf->cur_altsetting->desc.bInterfaceProtocol - != USB_INTERFACE_PROTOCOL_MOUSE) - return 0; - - pyra_keep_values_up_to_date(pyra, data); - - if (pyra->roccat_claimed) - pyra_report_to_chrdev(pyra, data); - - return 0; -} - -static const struct hid_device_id pyra_devices[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, - USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, - /* TODO add USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS after testing */ - { } -}; - -MODULE_DEVICE_TABLE(hid, pyra_devices); - -static struct hid_driver pyra_driver = { - .name = "pyra", - .id_table = pyra_devices, - .probe = pyra_probe, - .remove = pyra_remove, - .raw_event = pyra_raw_event -}; - -static int __init pyra_init(void) -{ - return hid_register_driver(&pyra_driver); -} - -static void __exit pyra_exit(void) -{ - hid_unregister_driver(&pyra_driver); -} - -module_init(pyra_init); -module_exit(pyra_exit); - -MODULE_AUTHOR("Stefan Achatz"); -MODULE_DESCRIPTION("USB Roccat Pyra driver"); -MODULE_LICENSE("GPL v2"); diff --git a/trunk/drivers/hid/hid-roccat-pyra.h b/trunk/drivers/hid/hid-roccat-pyra.h deleted file mode 100644 index 22f80a8f26f9..000000000000 --- a/trunk/drivers/hid/hid-roccat-pyra.h +++ /dev/null @@ -1,186 +0,0 @@ -#ifndef __HID_ROCCAT_PYRA_H -#define __HID_ROCCAT_PYRA_H - -/* - * Copyright (c) 2010 Stefan Achatz - */ - -/* - * 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. - */ - -#include - -#pragma pack(push) -#pragma pack(1) - -struct pyra_b { - uint8_t command; /* PYRA_COMMAND_B */ - uint8_t size; /* always 3 */ - uint8_t unknown; /* 1 */ -}; - -struct pyra_control { - uint8_t command; /* PYRA_COMMAND_CONTROL */ - /* - * value is profile number for request_settings and request_buttons - * 1 if status ok for request_status - */ - uint8_t value; /* Range 0-4 */ - uint8_t request; -}; - -enum pyra_control_requests { - PYRA_CONTROL_REQUEST_STATUS = 0x00, - PYRA_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10, - PYRA_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20 -}; - -struct pyra_settings { - uint8_t command; /* PYRA_COMMAND_SETTINGS */ - uint8_t size; /* always 3 */ - uint8_t startup_profile; /* Range 0-4! */ -}; - -struct pyra_profile_settings { - uint8_t command; /* PYRA_COMMAND_PROFILE_SETTINGS */ - uint8_t size; /* always 0xd */ - uint8_t number; /* Range 0-4 */ - uint8_t xysync; - uint8_t x_sensitivity; /* 0x1-0xa */ - uint8_t y_sensitivity; - uint8_t x_cpi; /* unused */ - uint8_t y_cpi; /* this value is for x and y */ - uint8_t lightswitch; /* 0 = off, 1 = on */ - uint8_t light_effect; - uint8_t handedness; - uint16_t checksum; /* byte sum */ -}; - -struct pyra_profile_buttons { - uint8_t command; /* PYRA_COMMAND_PROFILE_BUTTONS */ - uint8_t size; /* always 0x13 */ - uint8_t number; /* Range 0-4 */ - uint8_t buttons[14]; - uint16_t checksum; /* byte sum */ -}; - -struct pyra_info { - uint8_t command; /* PYRA_COMMAND_INFO */ - uint8_t size; /* always 6 */ - uint8_t firmware_version; - uint8_t unknown1; /* always 0 */ - uint8_t unknown2; /* always 1 */ - uint8_t unknown3; /* always 0 */ -}; - -enum pyra_commands { - PYRA_COMMAND_CONTROL = 0x4, - PYRA_COMMAND_SETTINGS = 0x5, - PYRA_COMMAND_PROFILE_SETTINGS = 0x6, - PYRA_COMMAND_PROFILE_BUTTONS = 0x7, - PYRA_COMMAND_INFO = 0x9, - PYRA_COMMAND_B = 0xb -}; - -enum pyra_usb_commands { - PYRA_USB_COMMAND_CONTROL = 0x304, - PYRA_USB_COMMAND_SETTINGS = 0x305, - PYRA_USB_COMMAND_PROFILE_SETTINGS = 0x306, - PYRA_USB_COMMAND_PROFILE_BUTTONS = 0x307, - PYRA_USB_COMMAND_INFO = 0x309, - PYRA_USB_COMMAND_B = 0x30b /* writes 3 bytes */ -}; - -enum pyra_mouse_report_numbers { - PYRA_MOUSE_REPORT_NUMBER_HID = 1, - PYRA_MOUSE_REPORT_NUMBER_AUDIO = 2, - PYRA_MOUSE_REPORT_NUMBER_BUTTON = 3, -}; - -struct pyra_mouse_event_button { - uint8_t report_number; /* always 3 */ - uint8_t unknown; /* always 0 */ - uint8_t type; - uint8_t data1; - uint8_t data2; -}; - -struct pyra_mouse_event_audio { - uint8_t report_number; /* always 2 */ - uint8_t type; - uint8_t unused; /* always 0 */ -}; - -/* hid audio controls */ -enum pyra_mouse_event_audio_types { - PYRA_MOUSE_EVENT_AUDIO_TYPE_MUTE = 0xe2, - PYRA_MOUSE_EVENT_AUDIO_TYPE_VOLUME_UP = 0xe9, - PYRA_MOUSE_EVENT_AUDIO_TYPE_VOLUME_DOWN = 0xea, -}; - -enum pyra_mouse_event_button_types { - /* - * Mouse sends tilt events on report_number 1 and 3 - * Tilt events are sent repeatedly with 0.94s between first and second - * event and 0.22s on subsequent - */ - PYRA_MOUSE_EVENT_BUTTON_TYPE_TILT = 0x10, - - /* - * These are sent sequentially - * data1 contains new profile number in range 1-5 - */ - PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_1 = 0x20, - PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2 = 0x30, - - /* - * data1 = button_number (rmp index) - * data2 = pressed/released - */ - PYRA_MOUSE_EVENT_BUTTON_TYPE_MACRO = 0x40, - PYRA_MOUSE_EVENT_BUTTON_TYPE_SHORTCUT = 0x50, - - /* - * data1 = button_number (rmp index) - */ - PYRA_MOUSE_EVENT_BUTTON_TYPE_QUICKLAUNCH = 0x60, - - /* data1 = new cpi */ - PYRA_MOUSE_EVENT_BUTTON_TYPE_CPI = 0xb0, - - /* data1 and data2 = new sensitivity */ - PYRA_MOUSE_EVENT_BUTTON_TYPE_SENSITIVITY = 0xc0, - - PYRA_MOUSE_EVENT_BUTTON_TYPE_MULTIMEDIA = 0xf0, -}; - -enum { - PYRA_MOUSE_EVENT_BUTTON_PRESS = 0, - PYRA_MOUSE_EVENT_BUTTON_RELEASE = 1, -}; - -struct pyra_roccat_report { - uint8_t type; - uint8_t value; - uint8_t key; -}; - -#pragma pack(pop) - -struct pyra_device { - int actual_profile; - int actual_cpi; - int firmware_version; - int roccat_claimed; - int chrdev_minor; - struct mutex pyra_lock; - struct pyra_settings settings; - struct pyra_profile_settings profile_settings[5]; - struct pyra_profile_buttons profile_buttons[5]; -}; - -#endif diff --git a/trunk/drivers/hid/hid-samsung.c b/trunk/drivers/hid/hid-samsung.c index 35894444e000..bda0fd60c98d 100644 --- a/trunk/drivers/hid/hid-samsung.c +++ b/trunk/drivers/hid/hid-samsung.c @@ -61,10 +61,10 @@ static inline void samsung_irda_dev_trace(struct hid_device *hdev, "descriptor\n", rsize); } -static __u8 *samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { - if (*rsize == 184 && rdesc[175] == 0x25 && rdesc[176] == 0x40 && + if (rsize == 184 && rdesc[175] == 0x25 && rdesc[176] == 0x40 && rdesc[177] == 0x75 && rdesc[178] == 0x30 && rdesc[179] == 0x95 && rdesc[180] == 0x01 && rdesc[182] == 0x40) { @@ -74,25 +74,24 @@ static __u8 *samsung_irda_report_fixup(struct hid_device *hdev, __u8 *rdesc, rdesc[180] = 0x06; rdesc[182] = 0x42; } else - if (*rsize == 203 && rdesc[192] == 0x15 && rdesc[193] == 0x0 && + if (rsize == 203 && rdesc[192] == 0x15 && rdesc[193] == 0x0 && rdesc[194] == 0x25 && rdesc[195] == 0x12) { samsung_irda_dev_trace(hdev, 203); rdesc[193] = 0x1; rdesc[195] = 0xf; } else - if (*rsize == 135 && rdesc[124] == 0x15 && rdesc[125] == 0x0 && + if (rsize == 135 && rdesc[124] == 0x15 && rdesc[125] == 0x0 && rdesc[126] == 0x25 && rdesc[127] == 0x11) { samsung_irda_dev_trace(hdev, 135); rdesc[125] = 0x1; rdesc[127] = 0xe; } else - if (*rsize == 171 && rdesc[160] == 0x15 && rdesc[161] == 0x0 && + if (rsize == 171 && rdesc[160] == 0x15 && rdesc[161] == 0x0 && rdesc[162] == 0x25 && rdesc[163] == 0x01) { samsung_irda_dev_trace(hdev, 171); rdesc[161] = 0x1; rdesc[163] = 0x3; } - return rdesc; } #define samsung_kbd_mouse_map_key_clear(c) \ @@ -131,12 +130,11 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev, return 1; } -static __u8 *samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void samsung_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { if (USB_DEVICE_ID_SAMSUNG_IR_REMOTE == hdev->product) - rdesc = samsung_irda_report_fixup(hdev, rdesc, rsize); - return rdesc; + samsung_irda_report_fixup(hdev, rdesc, rsize); } static int samsung_input_mapping(struct hid_device *hdev, struct hid_input *hi, diff --git a/trunk/drivers/hid/hid-sony.c b/trunk/drivers/hid/hid-sony.c index 677bb3da10e8..402d5574b574 100644 --- a/trunk/drivers/hid/hid-sony.c +++ b/trunk/drivers/hid/hid-sony.c @@ -24,46 +24,24 @@ #include "hid-ids.h" -#define VAIO_RDESC_CONSTANT (1 << 0) -#define SIXAXIS_CONTROLLER_USB (1 << 1) -#define SIXAXIS_CONTROLLER_BT (1 << 2) +#define VAIO_RDESC_CONSTANT 0x0001 struct sony_sc { unsigned long quirks; }; /* Sony Vaio VGX has wrongly mouse pointer declared as constant */ -static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void sony_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { struct sony_sc *sc = hid_get_drvdata(hdev); if ((sc->quirks & VAIO_RDESC_CONSTANT) && - *rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) { + rsize >= 56 && rdesc[54] == 0x81 && rdesc[55] == 0x07) { dev_info(&hdev->dev, "Fixing up Sony Vaio VGX report " "descriptor\n"); rdesc[55] = 0x06; } - return rdesc; -} - -static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf, - size_t count, unsigned char report_type) -{ - struct usb_interface *intf = to_usb_interface(hid->dev.parent); - struct usb_device *dev = interface_to_usbdev(intf); - struct usb_host_interface *interface = intf->cur_altsetting; - int report_id = buf[0]; - int ret; - - ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), - HID_REQ_SET_REPORT, - USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, - ((report_type + 1) << 8) | report_id, - interface->desc.bInterfaceNumber, buf, count, - USB_CTRL_SET_TIMEOUT); - - return ret; } /* @@ -71,7 +49,7 @@ static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf, * to "operational". Without this, the ps3 controller will not report any * events. */ -static int sixaxis_set_operational_usb(struct hid_device *hdev) +static int sony_set_operational_usb(struct hid_device *hdev) { struct usb_interface *intf = to_usb_interface(hdev->dev.parent); struct usb_device *dev = interface_to_usbdev(intf); @@ -96,7 +74,7 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev) return ret; } -static int sixaxis_set_operational_bt(struct hid_device *hdev) +static int sony_set_operational_bt(struct hid_device *hdev) { unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 }; return hdev->hid_output_raw_report(hdev, buf, sizeof(buf), HID_FEATURE_REPORT); @@ -130,14 +108,16 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) goto err_free; } - if (sc->quirks & SIXAXIS_CONTROLLER_USB) { - hdev->hid_output_raw_report = sixaxis_usb_output_raw_report; - ret = sixaxis_set_operational_usb(hdev); - } - else if (sc->quirks & SIXAXIS_CONTROLLER_BT) - ret = sixaxis_set_operational_bt(hdev); - else + switch (hdev->bus) { + case BUS_USB: + ret = sony_set_operational_usb(hdev); + break; + case BUS_BLUETOOTH: + ret = sony_set_operational_bt(hdev); + break; + default: ret = 0; + } if (ret < 0) goto err_stop; @@ -157,10 +137,8 @@ static void sony_remove(struct hid_device *hdev) } static const struct hid_device_id sony_devices[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER), - .driver_data = SIXAXIS_CONTROLLER_USB }, - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER), - .driver_data = SIXAXIS_CONTROLLER_BT }, + { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE), .driver_data = VAIO_RDESC_CONSTANT }, { } diff --git a/trunk/drivers/hid/hid-stantum.c b/trunk/drivers/hid/hid-stantum.c index 3171be28c3d5..90df886c5e04 100644 --- a/trunk/drivers/hid/hid-stantum.c +++ b/trunk/drivers/hid/hid-stantum.c @@ -249,8 +249,6 @@ static void stantum_remove(struct hid_device *hdev) static const struct hid_device_id stantum_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM, USB_DEVICE_ID_MTP) }, - { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, USB_DEVICE_ID_MTP_STM) }, - { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX, USB_DEVICE_ID_MTP_SITRONIX) }, { } }; MODULE_DEVICE_TABLE(hid, stantum_devices); diff --git a/trunk/drivers/hid/hid-sunplus.c b/trunk/drivers/hid/hid-sunplus.c index 164ed568f6cf..438107d9f1b2 100644 --- a/trunk/drivers/hid/hid-sunplus.c +++ b/trunk/drivers/hid/hid-sunplus.c @@ -22,17 +22,16 @@ #include "hid-ids.h" -static __u8 *sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void sp_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { - if (*rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && + if (rsize >= 107 && rdesc[104] == 0x26 && rdesc[105] == 0x80 && rdesc[106] == 0x03) { dev_info(&hdev->dev, "fixing up Sunplus Wireless Desktop " "report descriptor\n"); rdesc[105] = rdesc[110] = 0x03; rdesc[106] = rdesc[111] = 0x21; } - return rdesc; } #define sp_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \ diff --git a/trunk/drivers/hid/hid-uclogic.c b/trunk/drivers/hid/hid-uclogic.c deleted file mode 100644 index 05fdc85a76e5..000000000000 --- a/trunk/drivers/hid/hid-uclogic.c +++ /dev/null @@ -1,623 +0,0 @@ -/* - * HID driver for UC-Logic devices not fully compliant with HID standard - * - * Copyright (c) 2010 Nikolai Kondrashov - */ - -/* - * 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. - */ - -#include -#include -#include - -#include "hid-ids.h" - -/* - * The original descriptors of WPXXXXU tablets have three report IDs, of - * which only two are used (8 and 9), and the remaining (7) seems to have - * the originally intended pen description which was abandoned for some - * reason. From this unused description it is possible to extract the - * actual physical extents and resolution. All the models use the same - * descriptor with different extents for the unused report ID. - * - * Here it is: - * - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Pen), ; Pen (02h, application collection) - * Collection (Application), - * Report ID (7), - * Usage (Stylus), ; Stylus (20h, logical collection) - * Collection (Physical), - * Usage (Tip Switch), ; Tip switch (42h, momentary control) - * Usage (Barrel Switch), ; Barrel switch (44h, momentary control) - * Usage (Eraser), ; Eraser (45h, momentary control) - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (3), - * Input (Variable), - * Report Count (3), - * Input (Constant, Variable), - * Usage (In Range), ; In range (32h, momentary control) - * Report Count (1), - * Input (Variable), - * Report Count (1), - * Input (Constant, Variable), - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (X), ; X (30h, dynamic value) - * Report Size (16), - * Report Count (1), - * Push, - * Unit Exponent (13), - * Unit (Inch^3), - * Physical Minimum (0), - * Physical Maximum (Xpm), - * Logical Maximum (Xlm), - * Input (Variable), - * Usage (Y), ; Y (31h, dynamic value) - * Physical Maximum (Ypm), - * Logical Maximum (Ylm), - * Input (Variable), - * Pop, - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value) - * Logical Maximum (1023), - * Input (Variable), - * Report Size (16), - * End Collection, - * End Collection, - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (Mouse), ; Mouse (02h, application collection) - * Collection (Application), - * Report ID (8), - * Usage (Pointer), ; Pointer (01h, physical collection) - * Collection (Physical), - * Usage Page (Button), ; Button (09h) - * Usage Minimum (01h), - * Usage Maximum (03h), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Count (3), - * Report Size (1), - * Input (Variable), - * Report Count (5), - * Input (Constant), - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (X), ; X (30h, dynamic value) - * Usage (Y), ; Y (31h, dynamic value) - * Usage (Wheel), ; Wheel (38h, dynamic value) - * Usage (00h), - * Logical Minimum (-127), - * Logical Maximum (127), - * Report Size (8), - * Report Count (4), - * Input (Variable, Relative), - * End Collection, - * End Collection, - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (Mouse), ; Mouse (02h, application collection) - * Collection (Application), - * Report ID (9), - * Usage (Pointer), ; Pointer (01h, physical collection) - * Collection (Physical), - * Usage Page (Button), ; Button (09h) - * Usage Minimum (01h), - * Usage Maximum (03h), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Count (3), - * Report Size (1), - * Input (Variable), - * Report Count (5), - * Input (Constant), - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (X), ; X (30h, dynamic value) - * Usage (Y), ; Y (31h, dynamic value) - * Logical Minimum (0), - * Logical Maximum (32767), - * Physical Minimum (0), - * Physical Maximum (32767), - * Report Count (2), - * Report Size (16), - * Input (Variable), - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value) - * Logical Maximum (1023), - * Report Count (1), - * Report Size (16), - * Input (Variable), - * End Collection, - * End Collection - * - * Here are the extents values for the WPXXXXU models: - * - * Xpm Xlm Ypm Ylm - * WP4030U 4000 8000 3000 6000 - * WP5540U 5500 11000 4000 8000 - * WP8060U 8000 16000 6000 12000 - * - * This suggests that all of them have 2000 LPI resolution, as advertised. - */ - -/* Size of the original descriptor of WPXXXXU tablets */ -#define WPXXXXU_RDESC_ORIG_SIZE 212 - -/* - * Fixed WP4030U report descriptor. - * Although the hardware might actually support it, the mouse description - * has been removed, since there seems to be no devices having one and it - * wouldn't make much sense because of the working area size. - */ -static __u8 wp4030u_rdesc_fixed[] = { - 0x05, 0x0D, /* Usage Page (Digitizer), */ - 0x09, 0x02, /* Usage (Pen), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x09, /* Report ID (9), */ - 0x09, 0x20, /* Usage (Stylus), */ - 0xA0, /* Collection (Physical), */ - 0x75, 0x01, /* Report Size (1), */ - 0x09, 0x42, /* Usage (Tip Switch), */ - 0x09, 0x44, /* Usage (Barrel Switch), */ - 0x09, 0x46, /* Usage (Tablet Pick), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x05, /* Report Count (5), */ - 0x81, 0x01, /* Input (Constant), */ - 0x75, 0x10, /* Report Size (16), */ - 0x95, 0x01, /* Report Count (1), */ - 0x14, /* Logical Minimum (0), */ - 0xA4, /* Push, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x55, 0xFD, /* Unit Exponent (-3), */ - 0x65, 0x13, /* Unit (Inch), */ - 0x34, /* Physical Minimum (0), */ - 0x09, 0x30, /* Usage (X), */ - 0x46, 0xA0, 0x0F, /* Physical Maximum (4000), */ - 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ - 0x81, 0x02, /* Input (Variable), */ - 0x09, 0x31, /* Usage (Y), */ - 0x46, 0xB8, 0x0B, /* Physical Maximum (3000), */ - 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ - 0x81, 0x02, /* Input (Variable), */ - 0xB4, /* Pop, */ - 0x09, 0x30, /* Usage (Tip Pressure), */ - 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ - 0x81, 0x02, /* Input (Variable), */ - 0xC0, /* End Collection, */ - 0xC0 /* End Collection */ -}; - -/* Fixed WP5540U report descriptor */ -static __u8 wp5540u_rdesc_fixed[] = { - 0x05, 0x0D, /* Usage Page (Digitizer), */ - 0x09, 0x02, /* Usage (Pen), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x09, /* Report ID (9), */ - 0x09, 0x20, /* Usage (Stylus), */ - 0xA0, /* Collection (Physical), */ - 0x75, 0x01, /* Report Size (1), */ - 0x09, 0x42, /* Usage (Tip Switch), */ - 0x09, 0x44, /* Usage (Barrel Switch), */ - 0x09, 0x46, /* Usage (Tablet Pick), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x05, /* Report Count (5), */ - 0x81, 0x01, /* Input (Constant), */ - 0x75, 0x10, /* Report Size (16), */ - 0x95, 0x01, /* Report Count (1), */ - 0x14, /* Logical Minimum (0), */ - 0xA4, /* Push, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x55, 0xFD, /* Unit Exponent (-3), */ - 0x65, 0x13, /* Unit (Inch), */ - 0x34, /* Physical Minimum (0), */ - 0x09, 0x30, /* Usage (X), */ - 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */ - 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ - 0x81, 0x02, /* Input (Variable), */ - 0x09, 0x31, /* Usage (Y), */ - 0x46, 0xA0, 0x0F, /* Physical Maximum (4000), */ - 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ - 0x81, 0x02, /* Input (Variable), */ - 0xB4, /* Pop, */ - 0x09, 0x30, /* Usage (Tip Pressure), */ - 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ - 0x81, 0x02, /* Input (Variable), */ - 0xC0, /* End Collection, */ - 0xC0, /* End Collection, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x09, 0x02, /* Usage (Mouse), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x08, /* Report ID (8), */ - 0x09, 0x01, /* Usage (Pointer), */ - 0xA0, /* Collection (Physical), */ - 0x75, 0x01, /* Report Size (1), */ - 0x05, 0x09, /* Usage Page (Button), */ - 0x19, 0x01, /* Usage Minimum (01h), */ - 0x29, 0x03, /* Usage Maximum (03h), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x05, /* Report Count (5), */ - 0x81, 0x01, /* Input (Constant), */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x75, 0x08, /* Report Size (8), */ - 0x09, 0x30, /* Usage (X), */ - 0x09, 0x31, /* Usage (Y), */ - 0x15, 0x81, /* Logical Minimum (-127), */ - 0x25, 0x7F, /* Logical Maximum (127), */ - 0x95, 0x02, /* Report Count (2), */ - 0x81, 0x06, /* Input (Variable, Relative), */ - 0x09, 0x38, /* Usage (Wheel), */ - 0x15, 0xFF, /* Logical Minimum (-1), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x01, /* Report Count (1), */ - 0x81, 0x06, /* Input (Variable, Relative), */ - 0x81, 0x01, /* Input (Constant), */ - 0xC0, /* End Collection, */ - 0xC0 /* End Collection */ -}; - -/* Fixed WP8060U report descriptor */ -static __u8 wp8060u_rdesc_fixed[] = { - 0x05, 0x0D, /* Usage Page (Digitizer), */ - 0x09, 0x02, /* Usage (Pen), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x09, /* Report ID (9), */ - 0x09, 0x20, /* Usage (Stylus), */ - 0xA0, /* Collection (Physical), */ - 0x75, 0x01, /* Report Size (1), */ - 0x09, 0x42, /* Usage (Tip Switch), */ - 0x09, 0x44, /* Usage (Barrel Switch), */ - 0x09, 0x46, /* Usage (Tablet Pick), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x05, /* Report Count (5), */ - 0x81, 0x01, /* Input (Constant), */ - 0x75, 0x10, /* Report Size (16), */ - 0x95, 0x01, /* Report Count (1), */ - 0x14, /* Logical Minimum (0), */ - 0xA4, /* Push, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x55, 0xFD, /* Unit Exponent (-3), */ - 0x65, 0x13, /* Unit (Inch), */ - 0x34, /* Physical Minimum (0), */ - 0x09, 0x30, /* Usage (X), */ - 0x46, 0x40, 0x1F, /* Physical Maximum (8000), */ - 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ - 0x81, 0x02, /* Input (Variable), */ - 0x09, 0x31, /* Usage (Y), */ - 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ - 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ - 0x81, 0x02, /* Input (Variable), */ - 0xB4, /* Pop, */ - 0x09, 0x30, /* Usage (Tip Pressure), */ - 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ - 0x81, 0x02, /* Input (Variable), */ - 0xC0, /* End Collection, */ - 0xC0, /* End Collection, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x09, 0x02, /* Usage (Mouse), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x08, /* Report ID (8), */ - 0x09, 0x01, /* Usage (Pointer), */ - 0xA0, /* Collection (Physical), */ - 0x75, 0x01, /* Report Size (1), */ - 0x05, 0x09, /* Usage Page (Button), */ - 0x19, 0x01, /* Usage Minimum (01h), */ - 0x29, 0x03, /* Usage Maximum (03h), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x05, /* Report Count (5), */ - 0x81, 0x01, /* Input (Constant), */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x75, 0x08, /* Report Size (8), */ - 0x09, 0x30, /* Usage (X), */ - 0x09, 0x31, /* Usage (Y), */ - 0x15, 0x81, /* Logical Minimum (-127), */ - 0x25, 0x7F, /* Logical Maximum (127), */ - 0x95, 0x02, /* Report Count (2), */ - 0x81, 0x06, /* Input (Variable, Relative), */ - 0x09, 0x38, /* Usage (Wheel), */ - 0x15, 0xFF, /* Logical Minimum (-1), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x01, /* Report Count (1), */ - 0x81, 0x06, /* Input (Variable, Relative), */ - 0x81, 0x01, /* Input (Constant), */ - 0xC0, /* End Collection, */ - 0xC0 /* End Collection */ -}; - -/* - * Original PF1209 report descriptor. - * - * The descriptor is similar to WPXXXXU descriptors, with an addition of a - * feature report (ID 4) of unknown purpose. - * - * Although the advertised resolution is 4000 LPI the unused report ID - * (taken from WPXXXXU, it seems) states 2000 LPI, but it is probably - * incorrect and is a result of blind copying without understanding. Anyway - * the real logical extents are always scaled to 0..32767, which IMHO spoils - * the precision. - * - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Pen), ; Pen (02h, application collection) - * Collection (Application), - * Report ID (7), - * Usage (Stylus), ; Stylus (20h, logical collection) - * Collection (Physical), - * Usage (Tip Switch), ; Tip switch (42h, momentary control) - * Usage (Barrel Switch), ; Barrel switch (44h, momentary control) - * Usage (Eraser), ; Eraser (45h, momentary control) - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (3), - * Input (Variable), - * Report Count (3), - * Input (Constant, Variable), - * Usage (In Range), ; In range (32h, momentary control) - * Report Count (1), - * Input (Variable), - * Report Count (1), - * Input (Constant, Variable), - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (X), ; X (30h, dynamic value) - * Report Size (16), - * Report Count (1), - * Push, - * Unit Exponent (13), - * Unit (Inch^3), - * Physical Minimum (0), - * Physical Maximum (12000), - * Logical Maximum (24000), - * Input (Variable), - * Usage (Y), ; Y (31h, dynamic value) - * Physical Maximum (9000), - * Logical Maximum (18000), - * Input (Variable), - * Pop, - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value) - * Logical Maximum (1023), - * Input (Variable), - * Report Size (16), - * End Collection, - * End Collection, - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (Mouse), ; Mouse (02h, application collection) - * Collection (Application), - * Report ID (8), - * Usage (Pointer), ; Pointer (01h, physical collection) - * Collection (Physical), - * Usage Page (Button), ; Button (09h) - * Usage Minimum (01h), - * Usage Maximum (03h), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Count (3), - * Report Size (1), - * Input (Variable), - * Report Count (5), - * Input (Constant), - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (X), ; X (30h, dynamic value) - * Usage (Y), ; Y (31h, dynamic value) - * Usage (Wheel), ; Wheel (38h, dynamic value) - * Usage (00h), - * Logical Minimum (-127), - * Logical Maximum (127), - * Report Size (8), - * Report Count (4), - * Input (Variable, Relative), - * End Collection, - * End Collection, - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (Mouse), ; Mouse (02h, application collection) - * Collection (Application), - * Report ID (9), - * Usage (Pointer), ; Pointer (01h, physical collection) - * Collection (Physical), - * Usage Page (Button), ; Button (09h) - * Usage Minimum (01h), - * Usage Maximum (03h), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Count (3), - * Report Size (1), - * Input (Variable), - * Report Count (5), - * Input (Constant), - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (X), ; X (30h, dynamic value) - * Usage (Y), ; Y (31h, dynamic value) - * Logical Minimum (0), - * Logical Maximum (32767), - * Physical Minimum (0), - * Physical Maximum (32767), - * Report Count (2), - * Report Size (16), - * Input (Variable), - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value) - * Logical Maximum (1023), - * Report Count (1), - * Report Size (16), - * Input (Variable), - * End Collection, - * End Collection, - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (00h), - * Collection (Application), - * Report ID (4), - * Logical Minimum (0), - * Logical Maximum (255), - * Usage (00h), - * Report Size (8), - * Report Count (3), - * Feature (Variable), - * End Collection - */ - -/* Size of the original descriptor of PF1209 tablet */ -#define PF1209_RDESC_ORIG_SIZE 234 - -/* - * Fixed PF1209 report descriptor - * - * The descriptor is fixed similarly to WP5540U and WP8060U, plus the - * feature report is removed, because its purpose is unknown and it is of no - * use to the generic HID driver anyway for now. - */ -static __u8 pf1209_rdesc_fixed[] = { - 0x05, 0x0D, /* Usage Page (Digitizer), */ - 0x09, 0x02, /* Usage (Pen), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x09, /* Report ID (9), */ - 0x09, 0x20, /* Usage (Stylus), */ - 0xA0, /* Collection (Physical), */ - 0x75, 0x01, /* Report Size (1), */ - 0x09, 0x42, /* Usage (Tip Switch), */ - 0x09, 0x44, /* Usage (Barrel Switch), */ - 0x09, 0x46, /* Usage (Tablet Pick), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x05, /* Report Count (5), */ - 0x81, 0x01, /* Input (Constant), */ - 0x75, 0x10, /* Report Size (16), */ - 0x95, 0x01, /* Report Count (1), */ - 0x14, /* Logical Minimum (0), */ - 0xA4, /* Push, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x55, 0xFD, /* Unit Exponent (-3), */ - 0x65, 0x13, /* Unit (Inch), */ - 0x34, /* Physical Minimum (0), */ - 0x09, 0x30, /* Usage (X), */ - 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */ - 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ - 0x81, 0x02, /* Input (Variable), */ - 0x09, 0x31, /* Usage (Y), */ - 0x46, 0x28, 0x23, /* Physical Maximum (9000), */ - 0x26, 0xFF, 0x7F, /* Logical Maximum (32767), */ - 0x81, 0x02, /* Input (Variable), */ - 0xB4, /* Pop, */ - 0x09, 0x30, /* Usage (Tip Pressure), */ - 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ - 0x81, 0x02, /* Input (Variable), */ - 0xC0, /* End Collection, */ - 0xC0, /* End Collection, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x09, 0x02, /* Usage (Mouse), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x08, /* Report ID (8), */ - 0x09, 0x01, /* Usage (Pointer), */ - 0xA0, /* Collection (Physical), */ - 0x75, 0x01, /* Report Size (1), */ - 0x05, 0x09, /* Usage Page (Button), */ - 0x19, 0x01, /* Usage Minimum (01h), */ - 0x29, 0x03, /* Usage Maximum (03h), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x05, /* Report Count (5), */ - 0x81, 0x01, /* Input (Constant), */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x75, 0x08, /* Report Size (8), */ - 0x09, 0x30, /* Usage (X), */ - 0x09, 0x31, /* Usage (Y), */ - 0x15, 0x81, /* Logical Minimum (-127), */ - 0x25, 0x7F, /* Logical Maximum (127), */ - 0x95, 0x02, /* Report Count (2), */ - 0x81, 0x06, /* Input (Variable, Relative), */ - 0x09, 0x38, /* Usage (Wheel), */ - 0x15, 0xFF, /* Logical Minimum (-1), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x01, /* Report Count (1), */ - 0x81, 0x06, /* Input (Variable, Relative), */ - 0x81, 0x01, /* Input (Constant), */ - 0xC0, /* End Collection, */ - 0xC0 /* End Collection */ -}; - -static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) -{ - switch (hdev->product) { - case USB_DEVICE_ID_UCLOGIC_TABLET_PF1209: - if (*rsize == PF1209_RDESC_ORIG_SIZE) { - rdesc = pf1209_rdesc_fixed; - *rsize = sizeof(pf1209_rdesc_fixed); - } - break; - case USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U: - if (*rsize == WPXXXXU_RDESC_ORIG_SIZE) { - rdesc = wp4030u_rdesc_fixed; - *rsize = sizeof(wp4030u_rdesc_fixed); - } - break; - case USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U: - if (*rsize == WPXXXXU_RDESC_ORIG_SIZE) { - rdesc = wp5540u_rdesc_fixed; - *rsize = sizeof(wp5540u_rdesc_fixed); - } - break; - case USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U: - if (*rsize == WPXXXXU_RDESC_ORIG_SIZE) { - rdesc = wp8060u_rdesc_fixed; - *rsize = sizeof(wp8060u_rdesc_fixed); - } - break; - } - - return rdesc; -} - -static const struct hid_device_id uclogic_devices[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, - USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, - USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, - USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U) }, - { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, - USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U) }, - { } -}; -MODULE_DEVICE_TABLE(hid, uclogic_devices); - -static struct hid_driver uclogic_driver = { - .name = "uclogic", - .id_table = uclogic_devices, - .report_fixup = uclogic_report_fixup, -}; - -static int __init uclogic_init(void) -{ - return hid_register_driver(&uclogic_driver); -} - -static void __exit uclogic_exit(void) -{ - hid_unregister_driver(&uclogic_driver); -} - -module_init(uclogic_init); -module_exit(uclogic_exit); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/hid/hid-waltop.c b/trunk/drivers/hid/hid-waltop.c deleted file mode 100644 index b3a4163f2e67..000000000000 --- a/trunk/drivers/hid/hid-waltop.c +++ /dev/null @@ -1,1099 +0,0 @@ -/* - * HID driver for Waltop devices not fully compliant with HID standard - * - * Copyright (c) 2010 Nikolai Kondrashov - */ - -/* - * 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. - */ - -#include -#include -#include - -#include "hid-ids.h" - -/* - * There exists an official driver on the manufacturer's website, which - * wasn't submitted to the kernel, for some reason. The official driver - * doesn't seem to support extra features of some tablets, like wheels. - * - * It shows that the feature report ID 2 could be used to control any waltop - * tablet input mode, switching it between "default", "tablet" and "ink". - * - * This driver only uses "default" mode for all the supported tablets. This - * mode tries to be HID-compatible (not very successfully), but cripples the - * resolution of some tablets. - * - * The "tablet" mode uses some proprietary, yet decipherable protocol, which - * represents the correct resolution, but is possibly HID-incompatible (i.e. - * indescribable by a report descriptor). - * - * The purpose of the "ink" mode is unknown. - * - * The feature reports needed for switching to each mode are these: - * - * 02 16 00 default - * 02 16 01 tablet - * 02 16 02 ink - */ - -/* - * Original Slim Tablet 5.8 inch report descriptor. - * - * All the reports except the report with ID 16 (the stylus) are unused, - * possibly because the tablet is not configured to, or because they were - * just copied from a more capable model. The full purpose of features - * described for report ID 2 is unknown. - * - * The stylus buttons are described as three bit fields, whereas actually - * it's an "array", i.e. they're reported as button numbers (1, 2 and 3). - * The "eraser" field is not used. There is also a "push" without a "pop" in - * the stylus description. - * - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (Mouse), ; Mouse (02h, application collection) - * Collection (Application), - * Report ID (1), - * Usage (Pointer), ; Pointer (01h, physical collection) - * Collection (Physical), - * Usage Page (Button), ; Button (09h) - * Usage Minimum (01h), - * Usage Maximum (05h), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (5), - * Input (Variable), - * Report Size (3), - * Report Count (1), - * Input (Constant, Variable), - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (X), ; X (30h, dynamic value) - * Usage (Y), ; Y (31h, dynamic value) - * Usage (Wheel), ; Wheel (38h, dynamic value) - * Logical Minimum (-127), - * Logical Maximum (127), - * Report Size (8), - * Report Count (3), - * Input (Variable, Relative), - * End Collection, - * End Collection, - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Pen), ; Pen (02h, application collection) - * Collection (Application), - * Report ID (2), - * Usage (Stylus), ; Stylus (20h, logical collection) - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (7), - * Input (Variable), - * Usage (Azimuth), ; Azimuth (3Fh, dynamic value) - * Usage (Altitude), ; Altitude (40h, dynamic value) - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (2), - * Feature (Variable), - * End Collection, - * Report ID (5), - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Stylus), ; Stylus (20h, logical collection) - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (7), - * Input (Variable), - * End Collection, - * Report ID (10), - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Stylus), ; Stylus (20h, logical collection) - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (3), - * Input (Variable), - * End Collection, - * Report ID (16), - * Usage (Stylus), ; Stylus (20h, logical collection) - * Collection (Physical), - * Usage (Tip Switch), ; Tip switch (42h, momentary control) - * Usage (Barrel Switch), ; Barrel switch (44h, momentary control) - * Usage (Invert), ; Invert (3Ch, momentary control) - * Usage (Eraser), ; Eraser (45h, momentary control) - * Usage (In Range), ; In range (32h, momentary control) - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (5), - * Input (Variable), - * Report Count (3), - * Input (Constant, Variable), - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (X), ; X (30h, dynamic value) - * Report Size (16), - * Report Count (1), - * Push, - * Unit Exponent (13), - * Unit (Inch^3), - * Logical Minimum (0), - * Logical Maximum (10000), - * Physical Minimum (0), - * Physical Maximum (10000), - * Input (Variable), - * Usage (Y), ; Y (31h, dynamic value) - * Logical Maximum (6000), - * Physical Maximum (6000), - * Input (Variable), - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value) - * Logical Minimum (0), - * Logical Maximum (1023), - * Physical Minimum (0), - * Physical Maximum (1023), - * Input (Variable), - * End Collection, - * End Collection - */ - -/* Size of the original report descriptor of Slim Tablet 5.8 inch */ -#define SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE 222 - -/* - * Fixed Slim Tablet 5.8 inch descriptor. - * - * All the reports except the stylus report (ID 16) were removed as unused. - * The stylus buttons description was fixed. - */ -static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = { - 0x05, 0x0D, /* Usage Page (Digitizer), */ - 0x09, 0x02, /* Usage (Pen), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x10, /* Report ID (16), */ - 0x09, 0x20, /* Usage (Stylus), */ - 0xA0, /* Collection (Physical), */ - 0x09, 0x42, /* Usage (Tip Switch), */ - 0x09, 0x44, /* Usage (Barrel Switch), */ - 0x09, 0x46, /* Usage (Tablet Pick), */ - 0x15, 0x01, /* Logical Minimum (1), */ - 0x25, 0x03, /* Logical Maximum (3), */ - 0x75, 0x04, /* Report Size (4), */ - 0x95, 0x01, /* Report Count (1), */ - 0x80, /* Input, */ - 0x09, 0x32, /* Usage (In Range), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x75, 0x01, /* Report Size (1), */ - 0x95, 0x01, /* Report Count (1), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0x75, 0x10, /* Report Size (16), */ - 0x95, 0x01, /* Report Count (1), */ - 0x14, /* Logical Minimum (0), */ - 0xA4, /* Push, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x65, 0x13, /* Unit (Inch), */ - 0x55, 0xFD, /* Unit Exponent (-3), */ - 0x34, /* Physical Minimum (0), */ - 0x09, 0x30, /* Usage (X), */ - 0x46, 0x88, 0x13, /* Physical Maximum (5000), */ - 0x26, 0x10, 0x27, /* Logical Maximum (10000), */ - 0x81, 0x02, /* Input (Variable), */ - 0x09, 0x31, /* Usage (Y), */ - 0x46, 0xB8, 0x0B, /* Physical Maximum (3000), */ - 0x26, 0x70, 0x17, /* Logical Maximum (6000), */ - 0x81, 0x02, /* Input (Variable), */ - 0xB4, /* Pop, */ - 0x09, 0x30, /* Usage (Tip Pressure), */ - 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ - 0x81, 0x02, /* Input (Variable), */ - 0xC0, /* End Collection, */ - 0xC0 /* End Collection */ -}; - -/* - * Original Slim Tablet 12.1 inch report descriptor. - * - * The descriptor is similar to the Slim Tablet 5.8 inch descriptor with the - * addition of a keyboard report, seemingly unused. It may have get here - * from a Media Tablet - probably an unimplemented feature. - * - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (Mouse), ; Mouse (02h, application collection) - * Collection (Application), - * Report ID (1), - * Usage (Pointer), ; Pointer (01h, physical collection) - * Collection (Physical), - * Usage Page (Button), ; Button (09h) - * Usage Minimum (01h), - * Usage Maximum (05h), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (5), - * Input (Variable), - * Report Size (3), - * Report Count (1), - * Input (Constant, Variable), - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (X), ; X (30h, dynamic value) - * Usage (Y), ; Y (31h, dynamic value) - * Usage (Wheel), ; Wheel (38h, dynamic value) - * Logical Minimum (-127), - * Logical Maximum (127), - * Report Size (8), - * Report Count (3), - * Input (Variable, Relative), - * End Collection, - * End Collection, - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Pen), ; Pen (02h, application collection) - * Collection (Application), - * Report ID (2), - * Usage (Stylus), ; Stylus (20h, logical collection) - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (7), - * Input (Variable), - * Usage (Azimuth), ; Azimuth (3Fh, dynamic value) - * Usage (Altitude), ; Altitude (40h, dynamic value) - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (2), - * Feature (Variable), - * End Collection, - * Report ID (5), - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Stylus), ; Stylus (20h, logical collection) - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (7), - * Input (Variable), - * End Collection, - * Report ID (10), - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Stylus), ; Stylus (20h, logical collection) - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (3), - * Input (Variable), - * End Collection, - * Report ID (16), - * Usage (Stylus), ; Stylus (20h, logical collection) - * Collection (Physical), - * Usage (Tip Switch), ; Tip switch (42h, momentary control) - * Usage (Barrel Switch), ; Barrel switch (44h, momentary control) - * Usage (Invert), ; Invert (3Ch, momentary control) - * Usage (Eraser), ; Eraser (45h, momentary control) - * Usage (In Range), ; In range (32h, momentary control) - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (5), - * Input (Variable), - * Report Count (3), - * Input (Constant, Variable), - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (X), ; X (30h, dynamic value) - * Report Size (16), - * Report Count (1), - * Push, - * Unit Exponent (13), - * Unit (Inch^3), - * Logical Minimum (0), - * Logical Maximum (20000), - * Physical Minimum (0), - * Physical Maximum (20000), - * Input (Variable), - * Usage (Y), ; Y (31h, dynamic value) - * Logical Maximum (12500), - * Physical Maximum (12500), - * Input (Variable), - * Usage Page (Digitizer), ; Digitizer (0Dh) - * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value) - * Logical Minimum (0), - * Logical Maximum (1023), - * Physical Minimum (0), - * Physical Maximum (1023), - * Input (Variable), - * End Collection, - * End Collection, - * Usage Page (Desktop), ; Generic desktop controls (01h) - * Usage (Keyboard), ; Keyboard (06h, application collection) - * Collection (Application), - * Report ID (13), - * Usage Page (Keyboard), ; Keyboard/keypad (07h) - * Usage Minimum (KB Leftcontrol), ; Keyboard left control - * ; (E0h, dynamic value) - * Usage Maximum (KB Right GUI), ; Keyboard right GUI (E7h, dynamic value) - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (8), - * Input (Variable), - * Report Size (8), - * Report Count (1), - * Input (Constant), - * Usage Page (Keyboard), ; Keyboard/keypad (07h) - * Usage Minimum (None), ; No event (00h, selector) - * Usage Maximum (KB Application), ; Keyboard Application (65h, selector) - * Logical Minimum (0), - * Logical Maximum (101), - * Report Size (8), - * Report Count (5), - * Input, - * End Collection - */ - -/* Size of the original report descriptor of Slim Tablet 12.1 inch */ -#define SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE 269 - -/* - * Fixed Slim Tablet 12.1 inch descriptor. - * - * All the reports except the stylus report (ID 16) were removed as unused. - * The stylus buttons description was fixed. - */ -static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = { - 0x05, 0x0D, /* Usage Page (Digitizer), */ - 0x09, 0x02, /* Usage (Pen), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x10, /* Report ID (16), */ - 0x09, 0x20, /* Usage (Stylus), */ - 0xA0, /* Collection (Physical), */ - 0x09, 0x42, /* Usage (Tip Switch), */ - 0x09, 0x44, /* Usage (Barrel Switch), */ - 0x09, 0x46, /* Usage (Tablet Pick), */ - 0x15, 0x01, /* Logical Minimum (1), */ - 0x25, 0x03, /* Logical Maximum (3), */ - 0x75, 0x04, /* Report Size (4), */ - 0x95, 0x01, /* Report Count (1), */ - 0x80, /* Input, */ - 0x09, 0x32, /* Usage (In Range), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x75, 0x01, /* Report Size (1), */ - 0x95, 0x01, /* Report Count (1), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0x75, 0x10, /* Report Size (16), */ - 0x95, 0x01, /* Report Count (1), */ - 0x14, /* Logical Minimum (0), */ - 0xA4, /* Push, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x65, 0x13, /* Unit (Inch), */ - 0x55, 0xFD, /* Unit Exponent (-3), */ - 0x34, /* Physical Minimum (0), */ - 0x09, 0x30, /* Usage (X), */ - 0x46, 0x10, 0x27, /* Physical Maximum (10000), */ - 0x26, 0x20, 0x4E, /* Logical Maximum (20000), */ - 0x81, 0x02, /* Input (Variable), */ - 0x09, 0x31, /* Usage (Y), */ - 0x46, 0x6A, 0x18, /* Physical Maximum (6250), */ - 0x26, 0xD4, 0x30, /* Logical Maximum (12500), */ - 0x81, 0x02, /* Input (Variable), */ - 0xB4, /* Pop, */ - 0x09, 0x30, /* Usage (Tip Pressure), */ - 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ - 0x81, 0x02, /* Input (Variable), */ - 0xC0, /* End Collection, */ - 0xC0 /* End Collection */ -}; - -/* - * Original Media Tablet 10.6 inch report descriptor. - * - * There are at least two versions of this model in the wild. They are - * represented by Genius G-Pen M609 (older version) and Genius G-Pen M609X - * (newer version). - * - * Both versions have the usual pen with two barrel buttons and two - * identical wheels with center buttons in the top corners of the tablet - * base. They also have buttons on the top, between the wheels, for - * selecting the wheels' functions and wide/standard mode. In the wide mode - * the whole working surface is sensed, in the standard mode a narrower area - * is sensed, but the logical report extents remain the same. These modes - * correspond roughly to 16:9 and 4:3 aspect ratios respectively. - * - * The older version has three wheel function buttons ("scroll", "zoom" and - * "volume") and two separate buttons for wide and standard mode. The newer - * version has four wheel function buttons (plus "brush") and only one - * button is used for selecting wide/standard mode. So, the total number of - * buttons remains the same, but one of the mode buttons is repurposed as a - * wheels' function button in the newer version. - * - * The wheel functions are: - * scroll - the wheels act as scroll wheels, the center buttons switch - * between vertical and horizontal scrolling; - * zoom - the wheels zoom in/out, the buttons supposedly reset to 100%; - * volume - the wheels control the sound volume, the buttons mute; - * brush - the wheels are supposed to control brush width in a graphics - * editor, the buttons do nothing. - * - * Below is the newer version's report descriptor. It may very well be that - * the older version's descriptor is different and thus it won't be - * supported. - * - * The mouse report (ID 1) only uses the wheel field for reporting the tablet - * wheels' scroll mode. The keyboard report (ID 13) is used to report the - * wheels' zoom and brush control functions as key presses. The report ID 12 - * is used to report the wheels' volume control functions. The stylus report - * (ID 16) has the same problems as the Slim Tablet 5.8 inch report has. - * - * The rest of the reports are unused, at least in the default configuration. - * The purpose of the features is unknown. - * - * Usage Page (Desktop), - * Usage (Mouse), - * Collection (Application), - * Report ID (1), - * Usage (Pointer), - * Collection (Physical), - * Usage Page (Button), - * Usage Minimum (01h), - * Usage Maximum (05h), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (5), - * Input (Variable), - * Report Size (3), - * Report Count (1), - * Input (Constant, Variable), - * Usage Page (Desktop), - * Usage (X), - * Usage (Y), - * Usage (Wheel), - * Logical Minimum (-127), - * Logical Maximum (127), - * Report Size (8), - * Report Count (3), - * Input (Variable, Relative), - * End Collection, - * End Collection, - * Usage Page (Digitizer), - * Usage (Pen), - * Collection (Application), - * Report ID (2), - * Usage (Stylus), - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (7), - * Input (Variable), - * Usage (Azimuth), - * Usage (Altitude), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (2), - * Feature (Variable), - * End Collection, - * Report ID (5), - * Usage Page (Digitizer), - * Usage (Stylus), - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (7), - * Input (Variable), - * End Collection, - * Report ID (10), - * Usage Page (Digitizer), - * Usage (Stylus), - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (7), - * Input (Variable), - * End Collection, - * Report ID (16), - * Usage (Stylus), - * Collection (Physical), - * Usage (Tip Switch), - * Usage (Barrel Switch), - * Usage (Invert), - * Usage (Eraser), - * Usage (In Range), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (5), - * Input (Variable), - * Report Count (3), - * Input (Constant, Variable), - * Usage Page (Desktop), - * Usage (X), - * Report Size (16), - * Report Count (1), - * Push, - * Unit Exponent (13), - * Unit (Inch^3), - * Logical Minimum (0), - * Logical Maximum (18000), - * Physical Minimum (0), - * Physical Maximum (18000), - * Input (Variable), - * Usage (Y), - * Logical Maximum (11000), - * Physical Maximum (11000), - * Input (Variable), - * Usage Page (Digitizer), - * Usage (Tip Pressure), - * Logical Minimum (0), - * Logical Maximum (1023), - * Physical Minimum (0), - * Physical Maximum (1023), - * Input (Variable), - * End Collection, - * End Collection, - * Usage Page (Desktop), - * Usage (Keyboard), - * Collection (Application), - * Report ID (13), - * Usage Page (Keyboard), - * Usage Minimum (KB Leftcontrol), - * Usage Maximum (KB Right GUI), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (8), - * Input (Variable), - * Report Size (8), - * Report Count (1), - * Input (Constant), - * Usage Page (Keyboard), - * Usage Minimum (None), - * Usage Maximum (KB Application), - * Logical Minimum (0), - * Logical Maximum (101), - * Report Size (8), - * Report Count (5), - * Input, - * End Collection, - * Usage Page (Consumer), - * Usage (Consumer Control), - * Collection (Application), - * Report ID (12), - * Usage (Volume Inc), - * Usage (Volume Dec), - * Usage (Mute), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (3), - * Input (Variable, Relative), - * Report Size (5), - * Report Count (1), - * Input (Constant, Variable, Relative), - * End Collection - */ - -/* Size of the original report descriptor of Media Tablet 10.6 inch */ -#define MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE 300 - -/* - * Fixed Media Tablet 10.6 inch descriptor. - * - * The descriptions of reports unused in the default configuration are - * removed. The stylus report (ID 16) is fixed similarly to Slim Tablet 5.8 - * inch. The unused mouse report (ID 1) fields are replaced with constant - * padding. - * - * The keyboard report (ID 13) is hacked to instead have an "array" field - * reporting consumer page controls, and all the unused bits are masked out - * with constant padding. The "brush" wheels' function is represented as "Scan - * Previous/Next Track" controls due to the lack of brush controls in the - * usage tables specification. - */ -static __u8 media_tablet_10_6_inch_rdesc_fixed[] = { - 0x05, 0x0D, /* Usage Page (Digitizer), */ - 0x09, 0x02, /* Usage (Pen), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x10, /* Report ID (16), */ - 0x09, 0x20, /* Usage (Stylus), */ - 0xA0, /* Collection (Physical), */ - 0x09, 0x42, /* Usage (Tip Switch), */ - 0x09, 0x44, /* Usage (Barrel Switch), */ - 0x09, 0x46, /* Usage (Tablet Pick), */ - 0x15, 0x01, /* Logical Minimum (1), */ - 0x25, 0x03, /* Logical Maximum (3), */ - 0x75, 0x04, /* Report Size (4), */ - 0x95, 0x01, /* Report Count (1), */ - 0x80, /* Input, */ - 0x75, 0x01, /* Report Size (1), */ - 0x09, 0x32, /* Usage (In Range), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x01, /* Report Count (1), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0x75, 0x10, /* Report Size (16), */ - 0x95, 0x01, /* Report Count (1), */ - 0x14, /* Logical Minimum (0), */ - 0xA4, /* Push, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x65, 0x13, /* Unit (Inch), */ - 0x55, 0xFD, /* Unit Exponent (-3), */ - 0x34, /* Physical Minimum (0), */ - 0x09, 0x30, /* Usage (X), */ - 0x46, 0x28, 0x23, /* Physical Maximum (9000), */ - 0x26, 0x50, 0x46, /* Logical Maximum (18000), */ - 0x81, 0x02, /* Input (Variable), */ - 0x09, 0x31, /* Usage (Y), */ - 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */ - 0x26, 0xF8, 0x2A, /* Logical Maximum (11000), */ - 0x81, 0x02, /* Input (Variable), */ - 0xB4, /* Pop, */ - 0x09, 0x30, /* Usage (Tip Pressure), */ - 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ - 0x81, 0x02, /* Input (Variable), */ - 0xC0, /* End Collection, */ - 0xC0, /* End Collection, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x09, 0x02, /* Usage (Mouse), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x01, /* Report ID (1), */ - 0x09, 0x01, /* Usage (Pointer), */ - 0xA0, /* Collection (Physical), */ - 0x75, 0x08, /* Report Size (8), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0x95, 0x02, /* Report Count (2), */ - 0x15, 0xFF, /* Logical Minimum (-1), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x09, 0x38, /* Usage (Wheel), */ - 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */ - 0x0C, 0x00, - 0x81, 0x06, /* Input (Variable, Relative), */ - 0x95, 0x02, /* Report Count (2), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0xC0, /* End Collection, */ - 0xC0, /* End Collection, */ - 0x05, 0x0C, /* Usage Page (Consumer), */ - 0x09, 0x01, /* Usage (Consumer Control), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x0D, /* Report ID (13), */ - 0x95, 0x01, /* Report Count (1), */ - 0x75, 0x10, /* Report Size (16), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */ - 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ - 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ - 0x09, 0xB6, /* Usage (Scan Previous Track), */ - 0x09, 0xB5, /* Usage (Scan Next Track), */ - 0x08, /* Usage (00h), */ - 0x08, /* Usage (00h), */ - 0x08, /* Usage (00h), */ - 0x08, /* Usage (00h), */ - 0x08, /* Usage (00h), */ - 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ - 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ - 0x15, 0x0C, /* Logical Minimum (12), */ - 0x25, 0x17, /* Logical Maximum (23), */ - 0x75, 0x05, /* Report Size (5), */ - 0x80, /* Input, */ - 0x75, 0x03, /* Report Size (3), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0x75, 0x20, /* Report Size (32), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0xC0, /* End Collection, */ - 0x09, 0x01, /* Usage (Consumer Control), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x0C, /* Report ID (12), */ - 0x75, 0x01, /* Report Size (1), */ - 0x09, 0xE9, /* Usage (Volume Inc), */ - 0x09, 0xEA, /* Usage (Volume Dec), */ - 0x09, 0xE2, /* Usage (Mute), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x06, /* Input (Variable, Relative), */ - 0x95, 0x35, /* Report Count (53), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0xC0 /* End Collection */ -}; - -/* - * Original Media Tablet 14.1 inch report descriptor. - * - * There are at least two versions of this model in the wild. They are - * represented by Genius G-Pen M712 (older version) and Genius G-Pen M712X - * (newer version). The hardware difference between these versions is the same - * as between older and newer versions of Media Tablet 10.6 inch. The report - * descriptors are identical for both versions. - * - * The function, behavior and report descriptor of this tablet is similar to - * that of Media Tablet 10.6 inch. However, there is one more field (with - * Consumer AC Pan usage) in the mouse description. Then the tablet X and Y - * logical extents both get scaled to 0..16383 range (a hardware limit?), - * which kind of defeats the advertised 4000 LPI resolution, considering the - * physical extents of 12x7.25 inches. Plus, reports 5, 10 and 255 are used - * sometimes (while moving the pen) with unknown purpose. Also, the key codes - * generated for zoom in/out are different. - * - * Usage Page (Desktop), - * Usage (Mouse), - * Collection (Application), - * Report ID (1), - * Usage (Pointer), - * Collection (Physical), - * Usage Page (Button), - * Usage Minimum (01h), - * Usage Maximum (05h), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (5), - * Input (Variable), - * Report Size (3), - * Report Count (1), - * Input (Constant, Variable), - * Usage Page (Desktop), - * Usage (X), - * Usage (Y), - * Usage (Wheel), - * Logical Minimum (-127), - * Logical Maximum (127), - * Report Size (8), - * Report Count (3), - * Input (Variable, Relative), - * Usage Page (Consumer), - * Logical Minimum (-127), - * Logical Maximum (127), - * Report Size (8), - * Report Count (1), - * Usage (AC Pan), - * Input (Variable, Relative), - * End Collection, - * End Collection, - * Usage Page (Digitizer), - * Usage (Pen), - * Collection (Application), - * Report ID (2), - * Usage (Stylus), - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (7), - * Input (Variable), - * Usage (Azimuth), - * Usage (Altitude), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (2), - * Feature (Variable), - * End Collection, - * Report ID (5), - * Usage Page (Digitizer), - * Usage (Stylus), - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (7), - * Input (Variable), - * End Collection, - * Report ID (10), - * Usage Page (Digitizer), - * Usage (Stylus), - * Collection (Physical), - * Usage (00h), - * Logical Minimum (0), - * Logical Maximum (255), - * Report Size (8), - * Report Count (7), - * Input (Variable), - * End Collection, - * Report ID (16), - * Usage (Stylus), - * Collection (Physical), - * Usage (Tip Switch), - * Usage (Barrel Switch), - * Usage (Invert), - * Usage (Eraser), - * Usage (In Range), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (5), - * Input (Variable), - * Report Count (3), - * Input (Constant, Variable), - * Usage Page (Desktop), - * Usage (X), - * Report Size (16), - * Report Count (1), - * Push, - * Unit Exponent (13), - * Unit (Inch^3), - * Logical Minimum (0), - * Logical Maximum (16383), - * Physical Minimum (0), - * Physical Maximum (16383), - * Input (Variable), - * Usage (Y), - * Input (Variable), - * Usage Page (Digitizer), - * Usage (Tip Pressure), - * Logical Minimum (0), - * Logical Maximum (1023), - * Physical Minimum (0), - * Physical Maximum (1023), - * Input (Variable), - * End Collection, - * End Collection, - * Usage Page (Desktop), - * Usage (Keyboard), - * Collection (Application), - * Report ID (13), - * Usage Page (Keyboard), - * Usage Minimum (KB Leftcontrol), - * Usage Maximum (KB Right GUI), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (8), - * Input (Variable), - * Report Size (8), - * Report Count (1), - * Input (Constant), - * Usage Page (Keyboard), - * Usage Minimum (None), - * Usage Maximum (KB Application), - * Logical Minimum (0), - * Logical Maximum (101), - * Report Size (8), - * Report Count (5), - * Input, - * End Collection, - * Usage Page (Consumer), - * Usage (Consumer Control), - * Collection (Application), - * Report ID (12), - * Usage (Volume Inc), - * Usage (Volume Dec), - * Usage (Mute), - * Logical Minimum (0), - * Logical Maximum (1), - * Report Size (1), - * Report Count (3), - * Input (Variable, Relative), - * Report Size (5), - * Report Count (1), - * Input (Constant, Variable, Relative), - * End Collection - */ - -/* Size of the original report descriptor of Media Tablet 14.1 inch */ -#define MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE 309 - -/* - * Fixed Media Tablet 14.1 inch descriptor. - * It is fixed similarly to the Media Tablet 10.6 inch descriptor. - */ -static __u8 media_tablet_14_1_inch_rdesc_fixed[] = { - 0x05, 0x0D, /* Usage Page (Digitizer), */ - 0x09, 0x02, /* Usage (Pen), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x10, /* Report ID (16), */ - 0x09, 0x20, /* Usage (Stylus), */ - 0xA0, /* Collection (Physical), */ - 0x09, 0x42, /* Usage (Tip Switch), */ - 0x09, 0x44, /* Usage (Barrel Switch), */ - 0x09, 0x46, /* Usage (Tablet Pick), */ - 0x15, 0x01, /* Logical Minimum (1), */ - 0x25, 0x03, /* Logical Maximum (3), */ - 0x75, 0x04, /* Report Size (4), */ - 0x95, 0x01, /* Report Count (1), */ - 0x80, /* Input, */ - 0x75, 0x01, /* Report Size (1), */ - 0x09, 0x32, /* Usage (In Range), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x01, /* Report Count (1), */ - 0x81, 0x02, /* Input (Variable), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0x75, 0x10, /* Report Size (16), */ - 0x95, 0x01, /* Report Count (1), */ - 0x14, /* Logical Minimum (0), */ - 0xA4, /* Push, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x65, 0x13, /* Unit (Inch), */ - 0x55, 0xFD, /* Unit Exponent (-3), */ - 0x34, /* Physical Minimum (0), */ - 0x09, 0x30, /* Usage (X), */ - 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */ - 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */ - 0x81, 0x02, /* Input (Variable), */ - 0x09, 0x31, /* Usage (Y), */ - 0x46, 0x52, 0x1C, /* Physical Maximum (7250), */ - 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */ - 0x81, 0x02, /* Input (Variable), */ - 0xB4, /* Pop, */ - 0x09, 0x30, /* Usage (Tip Pressure), */ - 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ - 0x81, 0x02, /* Input (Variable), */ - 0xC0, /* End Collection, */ - 0xC0, /* End Collection, */ - 0x05, 0x01, /* Usage Page (Desktop), */ - 0x09, 0x02, /* Usage (Mouse), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x01, /* Report ID (1), */ - 0x09, 0x01, /* Usage (Pointer), */ - 0xA0, /* Collection (Physical), */ - 0x75, 0x08, /* Report Size (8), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0x95, 0x02, /* Report Count (2), */ - 0x15, 0xFF, /* Logical Minimum (-1), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x09, 0x38, /* Usage (Wheel), */ - 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */ - 0x0C, 0x00, - 0x81, 0x06, /* Input (Variable, Relative), */ - 0xC0, /* End Collection, */ - 0xC0, /* End Collection, */ - 0x05, 0x0C, /* Usage Page (Consumer), */ - 0x09, 0x01, /* Usage (Consumer Control), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x0D, /* Report ID (13), */ - 0x95, 0x01, /* Report Count (1), */ - 0x75, 0x10, /* Report Size (16), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */ - 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ - 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ - 0x09, 0xB6, /* Usage (Scan Previous Track), */ - 0x09, 0xB5, /* Usage (Scan Next Track), */ - 0x08, /* Usage (00h), */ - 0x08, /* Usage (00h), */ - 0x08, /* Usage (00h), */ - 0x08, /* Usage (00h), */ - 0x08, /* Usage (00h), */ - 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ - 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ - 0x15, 0x0C, /* Logical Minimum (12), */ - 0x25, 0x17, /* Logical Maximum (23), */ - 0x75, 0x05, /* Report Size (5), */ - 0x80, /* Input, */ - 0x75, 0x03, /* Report Size (3), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0x75, 0x20, /* Report Size (32), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0xC0, /* End Collection, */ - 0x09, 0x01, /* Usage (Consumer Control), */ - 0xA1, 0x01, /* Collection (Application), */ - 0x85, 0x0C, /* Report ID (12), */ - 0x75, 0x01, /* Report Size (1), */ - 0x09, 0xE9, /* Usage (Volume Inc), */ - 0x09, 0xEA, /* Usage (Volume Dec), */ - 0x09, 0xE2, /* Usage (Mute), */ - 0x14, /* Logical Minimum (0), */ - 0x25, 0x01, /* Logical Maximum (1), */ - 0x95, 0x03, /* Report Count (3), */ - 0x81, 0x06, /* Input (Variable, Relative), */ - 0x75, 0x05, /* Report Size (5), */ - 0x81, 0x03, /* Input (Constant, Variable), */ - 0xC0 /* End Collection */ -}; - -static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) -{ - switch (hdev->product) { - case USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH: - if (*rsize == SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE) { - rdesc = slim_tablet_5_8_inch_rdesc_fixed; - *rsize = sizeof(slim_tablet_5_8_inch_rdesc_fixed); - } - break; - case USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH: - if (*rsize == SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE) { - rdesc = slim_tablet_12_1_inch_rdesc_fixed; - *rsize = sizeof(slim_tablet_12_1_inch_rdesc_fixed); - } - break; - case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH: - if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) { - rdesc = media_tablet_10_6_inch_rdesc_fixed; - *rsize = sizeof(media_tablet_10_6_inch_rdesc_fixed); - } - break; - case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH: - if (*rsize == MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE) { - rdesc = media_tablet_14_1_inch_rdesc_fixed; - *rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed); - } - break; - } - return rdesc; -} - -static const struct hid_device_id waltop_devices[] = { - { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, - USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, - USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, - USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, - { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, - USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, - { } -}; -MODULE_DEVICE_TABLE(hid, waltop_devices); - -static struct hid_driver waltop_driver = { - .name = "waltop", - .id_table = waltop_devices, - .report_fixup = waltop_report_fixup, -}; - -static int __init waltop_init(void) -{ - return hid_register_driver(&waltop_driver); -} - -static void __exit waltop_exit(void) -{ - hid_unregister_driver(&waltop_driver); -} - -module_init(waltop_init); -module_exit(waltop_exit); -MODULE_LICENSE("GPL"); diff --git a/trunk/drivers/hid/hid-zydacron.c b/trunk/drivers/hid/hid-zydacron.c index aac1f9273149..9e8d35a203e4 100644 --- a/trunk/drivers/hid/hid-zydacron.c +++ b/trunk/drivers/hid/hid-zydacron.c @@ -27,10 +27,10 @@ struct zc_device { * Zydacron remote control has an invalid HID report descriptor, * that needs fixing before we can parse it. */ -static __u8 *zc_report_fixup(struct hid_device *hdev, __u8 *rdesc, - unsigned int *rsize) +static void zc_report_fixup(struct hid_device *hdev, __u8 *rdesc, + unsigned int rsize) { - if (*rsize >= 253 && + if (rsize >= 253 && rdesc[0x96] == 0xbc && rdesc[0x97] == 0xff && rdesc[0xca] == 0xbc && rdesc[0xcb] == 0xff && rdesc[0xe1] == 0xbc && rdesc[0xe2] == 0xff) { @@ -40,7 +40,6 @@ static __u8 *zc_report_fixup(struct hid_device *hdev, __u8 *rdesc, rdesc[0x96] = rdesc[0xca] = rdesc[0xe1] = 0x0c; rdesc[0x97] = rdesc[0xcb] = rdesc[0xe2] = 0x00; } - return rdesc; } #define zc_map_key_clear(c) \ diff --git a/trunk/drivers/hid/hidraw.c b/trunk/drivers/hid/hidraw.c index 8a4b32dca9f7..925992f549f0 100644 --- a/trunk/drivers/hid/hidraw.c +++ b/trunk/drivers/hid/hidraw.c @@ -218,13 +218,9 @@ static int hidraw_release(struct inode * inode, struct file * file) unsigned int minor = iminor(inode); struct hidraw *dev; struct hidraw_list *list = file->private_data; - int ret; - mutex_lock(&minors_lock); - if (!hidraw_table[minor]) { - ret = -ENODEV; - goto unlock; - } + if (!hidraw_table[minor]) + return -ENODEV; list_del(&list->node); dev = hidraw_table[minor]; @@ -237,12 +233,10 @@ static int hidraw_release(struct inode * inode, struct file * file) kfree(list->hidraw); } } + kfree(list); - ret = 0; -unlock: - mutex_unlock(&minors_lock); - return ret; + return 0; } static long hidraw_ioctl(struct file *file, unsigned int cmd, diff --git a/trunk/drivers/hid/usbhid/hid-core.c b/trunk/drivers/hid/usbhid/hid-core.c index 5489eab3a6bd..599041a7f670 100644 --- a/trunk/drivers/hid/usbhid/hid-core.c +++ b/trunk/drivers/hid/usbhid/hid-core.c @@ -807,10 +807,9 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co struct usb_host_interface *interface = intf->cur_altsetting; int ret; - if (usbhid->urbout && report_type != HID_FEATURE_REPORT) { + if (usbhid->urbout) { int actual_length; int skipped_report_id = 0; - if (buf[0] == 0x0) { /* Don't send the Report ID */ buf++; @@ -1470,6 +1469,9 @@ static int __init hid_init(void) retval = usbhid_quirks_init(quirks_param); if (retval) goto usbhid_quirks_init_fail; + retval = hiddev_init(); + if (retval) + goto hiddev_init_fail; retval = usb_register(&hid_driver); if (retval) goto usb_register_fail; @@ -1477,6 +1479,8 @@ static int __init hid_init(void) return 0; usb_register_fail: + hiddev_exit(); +hiddev_init_fail: usbhid_quirks_exit(); usbhid_quirks_init_fail: hid_unregister_driver(&hid_usb_driver); @@ -1489,6 +1493,7 @@ static int __init hid_init(void) static void __exit hid_exit(void) { usb_deregister(&hid_driver); + hiddev_exit(); usbhid_quirks_exit(); hid_unregister_driver(&hid_usb_driver); destroy_workqueue(resumption_waker); diff --git a/trunk/drivers/hid/usbhid/hid-quirks.c b/trunk/drivers/hid/usbhid/hid-quirks.c index 2c185477eeb3..f0260c699adb 100644 --- a/trunk/drivers/hid/usbhid/hid-quirks.c +++ b/trunk/drivers/hid/usbhid/hid-quirks.c @@ -34,6 +34,7 @@ static const struct hid_blacklist { { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, + { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, @@ -62,7 +63,6 @@ static const struct hid_blacklist { { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_YOKE, HID_QUIRK_NOGET }, { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_PRO_PEDALS, HID_QUIRK_NOGET }, { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, - { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, @@ -72,10 +72,6 @@ static const struct hid_blacklist { { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, - { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT }, - { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, - { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, - { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, diff --git a/trunk/drivers/hid/usbhid/hiddev.c b/trunk/drivers/hid/usbhid/hiddev.c index fedd88df9a18..dfcb27613ec5 100644 --- a/trunk/drivers/hid/usbhid/hiddev.c +++ b/trunk/drivers/hid/usbhid/hiddev.c @@ -67,6 +67,8 @@ struct hiddev_list { struct mutex thread_lock; }; +static struct usb_driver hiddev_driver; + /* * Find a report, given the report's type and ID. The ID can be specified * indirectly by REPORT_ID_FIRST (which returns the first report of the given @@ -924,3 +926,41 @@ void hiddev_disconnect(struct hid_device *hid) kfree(hiddev); } } + +/* Currently this driver is a USB driver. It's not a conventional one in + * the sense that it doesn't probe at the USB level. Instead it waits to + * be connected by HID through the hiddev_connect / hiddev_disconnect + * routines. The reason to register as a USB device is to gain part of the + * minor number space from the USB major. + * + * In theory, should the HID code be generalized to more than one physical + * medium (say, IEEE 1384), this driver will probably need to register its + * own major number, and in doing so, no longer need to register with USB. + * At that point the probe routine and hiddev_driver struct below will no + * longer be useful. + */ + + +/* We never attach in this manner, and rely on HID to connect us. This + * is why there is no disconnect routine defined in the usb_driver either. + */ +static int hiddev_usbd_probe(struct usb_interface *intf, + const struct usb_device_id *hiddev_info) +{ + return -ENODEV; +} + +static /* const */ struct usb_driver hiddev_driver = { + .name = "hiddev", + .probe = hiddev_usbd_probe, +}; + +int __init hiddev_init(void) +{ + return usb_register(&hiddev_driver); +} + +void hiddev_exit(void) +{ + usb_deregister(&hiddev_driver); +} diff --git a/trunk/drivers/i2c/Kconfig b/trunk/drivers/i2c/Kconfig index 30f06e956bfb..b923074b2cbe 100644 --- a/trunk/drivers/i2c/Kconfig +++ b/trunk/drivers/i2c/Kconfig @@ -75,7 +75,8 @@ config I2C_HELPER_AUTO In doubt, say Y. config I2C_SMBUS - tristate "SMBus-specific protocols" if !I2C_HELPER_AUTO + tristate + prompt "SMBus-specific protocols" if !I2C_HELPER_AUTO help Say Y here if you want support for SMBus extensions to the I2C specification. At the moment, the only supported extension is diff --git a/trunk/drivers/i2c/algos/Kconfig b/trunk/drivers/i2c/algos/Kconfig index 7b2ce4a08524..3998dd620a03 100644 --- a/trunk/drivers/i2c/algos/Kconfig +++ b/trunk/drivers/i2c/algos/Kconfig @@ -15,3 +15,15 @@ config I2C_ALGOPCA tristate "I2C PCA 9564 interfaces" endmenu + +# In automatic configuration mode, we still have to define the +# symbols to avoid unmet dependencies. + +if I2C_HELPER_AUTO +config I2C_ALGOBIT + tristate +config I2C_ALGOPCF + tristate +config I2C_ALGOPCA + tristate +endif diff --git a/trunk/include/crypto/cryptd.h b/trunk/include/crypto/cryptd.h index ba98918bbd9b..1c96b255017c 100644 --- a/trunk/include/crypto/cryptd.h +++ b/trunk/include/crypto/cryptd.h @@ -1,12 +1,5 @@ /* * Software async crypto daemon - * - * Added AEAD support to cryptd. - * Authors: Tadeusz Struk (tadeusz.struk@intel.com) - * Adrian Hoban - * Gabriele Paoloni - * Aidan O'Mahony (aidan.o.mahony@intel.com) - * Copyright (c) 2010, Intel Corporation. */ #ifndef _CRYPTO_CRYPT_H @@ -49,21 +42,4 @@ struct crypto_shash *cryptd_ahash_child(struct cryptd_ahash *tfm); struct shash_desc *cryptd_shash_desc(struct ahash_request *req); void cryptd_free_ahash(struct cryptd_ahash *tfm); -struct cryptd_aead { - struct crypto_aead base; -}; - -static inline struct cryptd_aead *__cryptd_aead_cast( - struct crypto_aead *tfm) -{ - return (struct cryptd_aead *)tfm; -} - -struct cryptd_aead *cryptd_alloc_aead(const char *alg_name, - u32 type, u32 mask); - -struct crypto_aead *cryptd_aead_child(struct cryptd_aead *tfm); - -void cryptd_free_aead(struct cryptd_aead *tfm); - #endif diff --git a/trunk/include/linux/hid.h b/trunk/include/linux/hid.h index bb0f56f5c01e..42a0f1d11365 100644 --- a/trunk/include/linux/hid.h +++ b/trunk/include/linux/hid.h @@ -316,7 +316,6 @@ struct hid_item { #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 #define HID_QUIRK_NO_IGNORE 0x40000000 -#define HID_QUIRK_NO_INPUT_SYNC 0x80000000 /* * This is the global environment of the parser. This information is @@ -627,8 +626,8 @@ struct hid_driver { int (*event)(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value); - __u8 *(*report_fixup)(struct hid_device *hdev, __u8 *buf, - unsigned int *size); + void (*report_fixup)(struct hid_device *hdev, __u8 *buf, + unsigned int size); int (*input_mapping)(struct hid_device *hdev, struct hid_input *hidinput, struct hid_field *field, diff --git a/trunk/include/linux/hiddev.h b/trunk/include/linux/hiddev.h index a3f481a3063b..bb6f58baf319 100644 --- a/trunk/include/linux/hiddev.h +++ b/trunk/include/linux/hiddev.h @@ -226,6 +226,8 @@ void hiddev_disconnect(struct hid_device *); void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value); void hiddev_report_event(struct hid_device *hid, struct hid_report *report); +int __init hiddev_init(void); +void hiddev_exit(void); #else static inline int hiddev_connect(struct hid_device *hid, unsigned int force) @@ -234,6 +236,8 @@ static inline void hiddev_disconnect(struct hid_device *hid) { } static inline void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) { } static inline void hiddev_report_event(struct hid_device *hid, struct hid_report *report) { } +static inline int hiddev_init(void) { return 0; } +static inline void hiddev_exit(void) { } #endif #endif diff --git a/trunk/include/linux/padata.h b/trunk/include/linux/padata.h index 4633b2f726b6..bdcd1e9eacea 100644 --- a/trunk/include/linux/padata.h +++ b/trunk/include/linux/padata.h @@ -127,8 +127,8 @@ struct padata_cpumask { */ struct parallel_data { struct padata_instance *pinst; - struct padata_parallel_queue __percpu *pqueue; - struct padata_serial_queue __percpu *squeue; + struct padata_parallel_queue *pqueue; + struct padata_serial_queue *squeue; atomic_t seq_nr; atomic_t reorder_objects; atomic_t refcnt;