diff options
-rw-r--r-- | drivers/input/input.c | 8 | ||||
-rw-r--r-- | include/linux/input.h | 104 | ||||
-rw-r--r-- | include/linux/mod_devicetable.h | 48 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 36 |
4 files changed, 122 insertions, 74 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index a935abeffffc..591c70d80cd8 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -286,19 +286,19 @@ static struct input_device_id *input_match_device(struct input_device_id *id, st | |||
286 | for (; id->flags || id->driver_info; id++) { | 286 | for (; id->flags || id->driver_info; id++) { |
287 | 287 | ||
288 | if (id->flags & INPUT_DEVICE_ID_MATCH_BUS) | 288 | if (id->flags & INPUT_DEVICE_ID_MATCH_BUS) |
289 | if (id->id.bustype != dev->id.bustype) | 289 | if (id->bustype != dev->id.bustype) |
290 | continue; | 290 | continue; |
291 | 291 | ||
292 | if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR) | 292 | if (id->flags & INPUT_DEVICE_ID_MATCH_VENDOR) |
293 | if (id->id.vendor != dev->id.vendor) | 293 | if (id->vendor != dev->id.vendor) |
294 | continue; | 294 | continue; |
295 | 295 | ||
296 | if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT) | 296 | if (id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT) |
297 | if (id->id.product != dev->id.product) | 297 | if (id->product != dev->id.product) |
298 | continue; | 298 | continue; |
299 | 299 | ||
300 | if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION) | 300 | if (id->flags & INPUT_DEVICE_ID_MATCH_VERSION) |
301 | if (id->id.version != dev->id.version) | 301 | if (id->version != dev->id.version) |
302 | continue; | 302 | continue; |
303 | 303 | ||
304 | MATCH_BIT(evbit, EV_MAX); | 304 | MATCH_BIT(evbit, EV_MAX); |
diff --git a/include/linux/input.h b/include/linux/input.h index 16c19d710a4d..8298b4bf5a07 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -12,8 +12,6 @@ | |||
12 | #ifdef __KERNEL__ | 12 | #ifdef __KERNEL__ |
13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
15 | #include <linux/device.h> | ||
16 | #include <linux/mod_devicetable.h> | ||
17 | #else | 15 | #else |
18 | #include <sys/time.h> | 16 | #include <sys/time.h> |
19 | #include <sys/ioctl.h> | 17 | #include <sys/ioctl.h> |
@@ -577,15 +575,15 @@ struct input_absinfo { | |||
577 | * Switch events | 575 | * Switch events |
578 | */ | 576 | */ |
579 | 577 | ||
580 | #define SW_0 0x00 | 578 | #define SW_0 0x00 |
581 | #define SW_1 0x01 | 579 | #define SW_1 0x01 |
582 | #define SW_2 0x02 | 580 | #define SW_2 0x02 |
583 | #define SW_3 0x03 | 581 | #define SW_3 0x03 |
584 | #define SW_4 0x04 | 582 | #define SW_4 0x04 |
585 | #define SW_5 0x05 | 583 | #define SW_5 0x05 |
586 | #define SW_6 0x06 | 584 | #define SW_6 0x06 |
587 | #define SW_7 0x07 | 585 | #define SW_7 0x07 |
588 | #define SW_MAX 0x0f | 586 | #define SW_MAX 0x0f |
589 | 587 | ||
590 | /* | 588 | /* |
591 | * Misc events | 589 | * Misc events |
@@ -805,52 +803,16 @@ struct ff_effect { | |||
805 | 803 | ||
806 | #define FF_MAX 0x7f | 804 | #define FF_MAX 0x7f |
807 | 805 | ||
808 | struct input_device_id { | ||
809 | |||
810 | kernel_ulong_t flags; | ||
811 | |||
812 | struct input_id id; | ||
813 | |||
814 | kernel_ulong_t evbit[EV_MAX/BITS_PER_LONG+1]; | ||
815 | kernel_ulong_t keybit[KEY_MAX/BITS_PER_LONG+1]; | ||
816 | kernel_ulong_t relbit[REL_MAX/BITS_PER_LONG+1]; | ||
817 | kernel_ulong_t absbit[ABS_MAX/BITS_PER_LONG+1]; | ||
818 | kernel_ulong_t mscbit[MSC_MAX/BITS_PER_LONG+1]; | ||
819 | kernel_ulong_t ledbit[LED_MAX/BITS_PER_LONG+1]; | ||
820 | kernel_ulong_t sndbit[SND_MAX/BITS_PER_LONG+1]; | ||
821 | kernel_ulong_t ffbit[FF_MAX/BITS_PER_LONG+1]; | ||
822 | kernel_ulong_t swbit[SW_MAX/BITS_PER_LONG+1]; | ||
823 | |||
824 | kernel_ulong_t driver_info; | ||
825 | }; | ||
826 | |||
827 | /* | ||
828 | * Structure for hotplug & device<->driver matching. | ||
829 | */ | ||
830 | |||
831 | #define INPUT_DEVICE_ID_MATCH_BUS 1 | ||
832 | #define INPUT_DEVICE_ID_MATCH_VENDOR 2 | ||
833 | #define INPUT_DEVICE_ID_MATCH_PRODUCT 4 | ||
834 | #define INPUT_DEVICE_ID_MATCH_VERSION 8 | ||
835 | |||
836 | #define INPUT_DEVICE_ID_MATCH_EVBIT 0x010 | ||
837 | #define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020 | ||
838 | #define INPUT_DEVICE_ID_MATCH_RELBIT 0x040 | ||
839 | #define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080 | ||
840 | #define INPUT_DEVICE_ID_MATCH_MSCIT 0x100 | ||
841 | #define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200 | ||
842 | #define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400 | ||
843 | #define INPUT_DEVICE_ID_MATCH_FFBIT 0x800 | ||
844 | #define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000 | ||
845 | |||
846 | #ifdef __KERNEL__ | 806 | #ifdef __KERNEL__ |
847 | 807 | ||
848 | /* | 808 | /* |
849 | * In-kernel definitions. | 809 | * In-kernel definitions. |
850 | */ | 810 | */ |
851 | 811 | ||
812 | #include <linux/device.h> | ||
852 | #include <linux/fs.h> | 813 | #include <linux/fs.h> |
853 | #include <linux/timer.h> | 814 | #include <linux/timer.h> |
815 | #include <linux/mod_devicetable.h> | ||
854 | 816 | ||
855 | #define NBITS(x) (((x)/BITS_PER_LONG)+1) | 817 | #define NBITS(x) (((x)/BITS_PER_LONG)+1) |
856 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) | 818 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) |
@@ -951,9 +913,49 @@ struct input_dev { | |||
951 | }; | 913 | }; |
952 | #define to_input_dev(d) container_of(d, struct input_dev, cdev) | 914 | #define to_input_dev(d) container_of(d, struct input_dev, cdev) |
953 | 915 | ||
954 | #define INPUT_DEVICE_ID_MATCH_DEVICE\ | 916 | /* |
917 | * Verify that we are in sync with input_device_id mod_devicetable.h #defines | ||
918 | */ | ||
919 | |||
920 | #if EV_MAX != INPUT_DEVICE_ID_EV_MAX | ||
921 | #error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match" | ||
922 | #endif | ||
923 | |||
924 | #if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX | ||
925 | #error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match" | ||
926 | #endif | ||
927 | |||
928 | #if REL_MAX != INPUT_DEVICE_ID_REL_MAX | ||
929 | #error "REL_MAX and INPUT_DEVICE_ID_REL_MAX do not match" | ||
930 | #endif | ||
931 | |||
932 | #if ABS_MAX != INPUT_DEVICE_ID_ABS_MAX | ||
933 | #error "ABS_MAX and INPUT_DEVICE_ID_ABS_MAX do not match" | ||
934 | #endif | ||
935 | |||
936 | #if MSC_MAX != INPUT_DEVICE_ID_MSC_MAX | ||
937 | #error "MSC_MAX and INPUT_DEVICE_ID_MSC_MAX do not match" | ||
938 | #endif | ||
939 | |||
940 | #if LED_MAX != INPUT_DEVICE_ID_LED_MAX | ||
941 | #error "LED_MAX and INPUT_DEVICE_ID_LED_MAX do not match" | ||
942 | #endif | ||
943 | |||
944 | #if SND_MAX != INPUT_DEVICE_ID_SND_MAX | ||
945 | #error "SND_MAX and INPUT_DEVICE_ID_SND_MAX do not match" | ||
946 | #endif | ||
947 | |||
948 | #if FF_MAX != INPUT_DEVICE_ID_FF_MAX | ||
949 | #error "FF_MAX and INPUT_DEVICE_ID_FF_MAX do not match" | ||
950 | #endif | ||
951 | |||
952 | #if SW_MAX != INPUT_DEVICE_ID_SW_MAX | ||
953 | #error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match" | ||
954 | #endif | ||
955 | |||
956 | #define INPUT_DEVICE_ID_MATCH_DEVICE \ | ||
955 | (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) | 957 | (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT) |
956 | #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\ | 958 | #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \ |
957 | (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) | 959 | (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION) |
958 | 960 | ||
959 | struct input_handle; | 961 | struct input_handle; |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 7b08c11ec4cc..f6977708585c 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -249,4 +249,52 @@ struct i2c_device_id { | |||
249 | __u16 id; | 249 | __u16 id; |
250 | }; | 250 | }; |
251 | 251 | ||
252 | /* Input */ | ||
253 | #define INPUT_DEVICE_ID_EV_MAX 0x1f | ||
254 | #define INPUT_DEVICE_ID_KEY_MAX 0x1ff | ||
255 | #define INPUT_DEVICE_ID_REL_MAX 0x0f | ||
256 | #define INPUT_DEVICE_ID_ABS_MAX 0x3f | ||
257 | #define INPUT_DEVICE_ID_MSC_MAX 0x07 | ||
258 | #define INPUT_DEVICE_ID_LED_MAX 0x0f | ||
259 | #define INPUT_DEVICE_ID_SND_MAX 0x07 | ||
260 | #define INPUT_DEVICE_ID_FF_MAX 0x7f | ||
261 | #define INPUT_DEVICE_ID_SW_MAX 0x0f | ||
262 | |||
263 | #define INPUT_DEVICE_ID_MATCH_BUS 1 | ||
264 | #define INPUT_DEVICE_ID_MATCH_VENDOR 2 | ||
265 | #define INPUT_DEVICE_ID_MATCH_PRODUCT 4 | ||
266 | #define INPUT_DEVICE_ID_MATCH_VERSION 8 | ||
267 | |||
268 | #define INPUT_DEVICE_ID_MATCH_EVBIT 0x0010 | ||
269 | #define INPUT_DEVICE_ID_MATCH_KEYBIT 0x0020 | ||
270 | #define INPUT_DEVICE_ID_MATCH_RELBIT 0x0040 | ||
271 | #define INPUT_DEVICE_ID_MATCH_ABSBIT 0x0080 | ||
272 | #define INPUT_DEVICE_ID_MATCH_MSCIT 0x0100 | ||
273 | #define INPUT_DEVICE_ID_MATCH_LEDBIT 0x0200 | ||
274 | #define INPUT_DEVICE_ID_MATCH_SNDBIT 0x0400 | ||
275 | #define INPUT_DEVICE_ID_MATCH_FFBIT 0x0800 | ||
276 | #define INPUT_DEVICE_ID_MATCH_SWBIT 0x1000 | ||
277 | |||
278 | struct input_device_id { | ||
279 | |||
280 | kernel_ulong_t flags; | ||
281 | |||
282 | __u16 bustype; | ||
283 | __u16 vendor; | ||
284 | __u16 product; | ||
285 | __u16 version; | ||
286 | |||
287 | kernel_ulong_t evbit[INPUT_DEVICE_ID_EV_MAX / BITS_PER_LONG + 1]; | ||
288 | kernel_ulong_t keybit[INPUT_DEVICE_ID_KEY_MAX / BITS_PER_LONG + 1]; | ||
289 | kernel_ulong_t relbit[INPUT_DEVICE_ID_REL_MAX / BITS_PER_LONG + 1]; | ||
290 | kernel_ulong_t absbit[INPUT_DEVICE_ID_ABS_MAX / BITS_PER_LONG + 1]; | ||
291 | kernel_ulong_t mscbit[INPUT_DEVICE_ID_MSC_MAX / BITS_PER_LONG + 1]; | ||
292 | kernel_ulong_t ledbit[INPUT_DEVICE_ID_LED_MAX / BITS_PER_LONG + 1]; | ||
293 | kernel_ulong_t sndbit[INPUT_DEVICE_ID_SND_MAX / BITS_PER_LONG + 1]; | ||
294 | kernel_ulong_t ffbit[INPUT_DEVICE_ID_FF_MAX / BITS_PER_LONG + 1]; | ||
295 | kernel_ulong_t swbit[INPUT_DEVICE_ID_SW_MAX / BITS_PER_LONG + 1]; | ||
296 | |||
297 | kernel_ulong_t driver_info; | ||
298 | }; | ||
299 | |||
252 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 300 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 84e21201f3c0..37f67c23e11b 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -374,10 +374,10 @@ static void do_input(char *alias, | |||
374 | kernel_ulong_t *arr, unsigned int min, unsigned int max) | 374 | kernel_ulong_t *arr, unsigned int min, unsigned int max) |
375 | { | 375 | { |
376 | unsigned int i; | 376 | unsigned int i; |
377 | for (i = min; i < max; i++) { | 377 | |
378 | if (arr[i/BITS_PER_LONG] & (1 << (i%BITS_PER_LONG))) | 378 | for (i = min; i < max; i++) |
379 | sprintf(alias+strlen(alias), "%X,*", i); | 379 | if (arr[i / BITS_PER_LONG] & (1 << (i%BITS_PER_LONG))) |
380 | } | 380 | sprintf(alias + strlen(alias), "%X,*", i); |
381 | } | 381 | } |
382 | 382 | ||
383 | /* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */ | 383 | /* input:b0v0p0e0-eXkXrXaXmXlXsXfXwX where X is comma-separated %02X. */ |
@@ -386,39 +386,37 @@ static int do_input_entry(const char *filename, struct input_device_id *id, | |||
386 | { | 386 | { |
387 | sprintf(alias, "input:"); | 387 | sprintf(alias, "input:"); |
388 | 388 | ||
389 | ADD(alias, "b", id->flags&INPUT_DEVICE_ID_MATCH_BUS, id->id.bustype); | 389 | ADD(alias, "b", id->flags & INPUT_DEVICE_ID_MATCH_BUS, id->bustype); |
390 | ADD(alias, "v", id->flags&INPUT_DEVICE_ID_MATCH_VENDOR, id->id.vendor); | 390 | ADD(alias, "v", id->flags & INPUT_DEVICE_ID_MATCH_VENDOR, id->vendor); |
391 | ADD(alias, "p", id->flags&INPUT_DEVICE_ID_MATCH_PRODUCT, | 391 | ADD(alias, "p", id->flags & INPUT_DEVICE_ID_MATCH_PRODUCT, id->product); |
392 | id->id.product); | 392 | ADD(alias, "e", id->flags & INPUT_DEVICE_ID_MATCH_VERSION, id->version); |
393 | ADD(alias, "e", id->flags&INPUT_DEVICE_ID_MATCH_VERSION, | ||
394 | id->id.version); | ||
395 | 393 | ||
396 | sprintf(alias + strlen(alias), "-e*"); | 394 | sprintf(alias + strlen(alias), "-e*"); |
397 | if (id->flags&INPUT_DEVICE_ID_MATCH_EVBIT) | 395 | if (id->flags & INPUT_DEVICE_ID_MATCH_EVBIT) |
398 | do_input(alias, id->evbit, 0, EV_MAX); | 396 | do_input(alias, id->evbit, 0, EV_MAX); |
399 | sprintf(alias + strlen(alias), "k*"); | 397 | sprintf(alias + strlen(alias), "k*"); |
400 | if (id->flags&INPUT_DEVICE_ID_MATCH_KEYBIT) | 398 | if (id->flags & INPUT_DEVICE_ID_MATCH_KEYBIT) |
401 | do_input(alias, id->keybit, KEY_MIN_INTERESTING, KEY_MAX); | 399 | do_input(alias, id->keybit, KEY_MIN_INTERESTING, KEY_MAX); |
402 | sprintf(alias + strlen(alias), "r*"); | 400 | sprintf(alias + strlen(alias), "r*"); |
403 | if (id->flags&INPUT_DEVICE_ID_MATCH_RELBIT) | 401 | if (id->flags & INPUT_DEVICE_ID_MATCH_RELBIT) |
404 | do_input(alias, id->relbit, 0, REL_MAX); | 402 | do_input(alias, id->relbit, 0, REL_MAX); |
405 | sprintf(alias + strlen(alias), "a*"); | 403 | sprintf(alias + strlen(alias), "a*"); |
406 | if (id->flags&INPUT_DEVICE_ID_MATCH_ABSBIT) | 404 | if (id->flags & INPUT_DEVICE_ID_MATCH_ABSBIT) |
407 | do_input(alias, id->absbit, 0, ABS_MAX); | 405 | do_input(alias, id->absbit, 0, ABS_MAX); |
408 | sprintf(alias + strlen(alias), "m*"); | 406 | sprintf(alias + strlen(alias), "m*"); |
409 | if (id->flags&INPUT_DEVICE_ID_MATCH_MSCIT) | 407 | if (id->flags & INPUT_DEVICE_ID_MATCH_MSCIT) |
410 | do_input(alias, id->mscbit, 0, MSC_MAX); | 408 | do_input(alias, id->mscbit, 0, MSC_MAX); |
411 | sprintf(alias + strlen(alias), "l*"); | 409 | sprintf(alias + strlen(alias), "l*"); |
412 | if (id->flags&INPUT_DEVICE_ID_MATCH_LEDBIT) | 410 | if (id->flags & INPUT_DEVICE_ID_MATCH_LEDBIT) |
413 | do_input(alias, id->ledbit, 0, LED_MAX); | 411 | do_input(alias, id->ledbit, 0, LED_MAX); |
414 | sprintf(alias + strlen(alias), "s*"); | 412 | sprintf(alias + strlen(alias), "s*"); |
415 | if (id->flags&INPUT_DEVICE_ID_MATCH_SNDBIT) | 413 | if (id->flags & INPUT_DEVICE_ID_MATCH_SNDBIT) |
416 | do_input(alias, id->sndbit, 0, SND_MAX); | 414 | do_input(alias, id->sndbit, 0, SND_MAX); |
417 | sprintf(alias + strlen(alias), "f*"); | 415 | sprintf(alias + strlen(alias), "f*"); |
418 | if (id->flags&INPUT_DEVICE_ID_MATCH_FFBIT) | 416 | if (id->flags & INPUT_DEVICE_ID_MATCH_FFBIT) |
419 | do_input(alias, id->ffbit, 0, FF_MAX); | 417 | do_input(alias, id->ffbit, 0, FF_MAX); |
420 | sprintf(alias + strlen(alias), "w*"); | 418 | sprintf(alias + strlen(alias), "w*"); |
421 | if (id->flags&INPUT_DEVICE_ID_MATCH_SWBIT) | 419 | if (id->flags & INPUT_DEVICE_ID_MATCH_SWBIT) |
422 | do_input(alias, id->swbit, 0, SW_MAX); | 420 | do_input(alias, id->swbit, 0, SW_MAX); |
423 | return 1; | 421 | return 1; |
424 | } | 422 | } |