diff options
author | Steve French <sfrench@us.ibm.com> | 2006-01-17 22:49:59 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2006-01-17 22:49:59 -0500 |
commit | d65177c1ae7f085723154105c5dc8d9e16ae8265 (patch) | |
tree | 14408129d880d89cc5e937f2810f243ed1e6fcde /drivers/input/input.c | |
parent | d41f084a74de860fe879403fbbad13abdf7aea8e (diff) | |
parent | 15578eeb6cd4b74492f26e60624aa1a9a52ddd7b (diff) |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'drivers/input/input.c')
-rw-r--r-- | drivers/input/input.c | 55 |
1 files changed, 37 insertions, 18 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index fe33ff334e27..4fe3da3c667a 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -528,40 +528,56 @@ INPUT_DEV_STRING_ATTR_SHOW(name); | |||
528 | INPUT_DEV_STRING_ATTR_SHOW(phys); | 528 | INPUT_DEV_STRING_ATTR_SHOW(phys); |
529 | INPUT_DEV_STRING_ATTR_SHOW(uniq); | 529 | INPUT_DEV_STRING_ATTR_SHOW(uniq); |
530 | 530 | ||
531 | static int print_modalias_bits(char *buf, char prefix, unsigned long *arr, | 531 | static int print_modalias_bits(char *buf, int size, char prefix, unsigned long *arr, |
532 | unsigned int min, unsigned int max) | 532 | unsigned int min, unsigned int max) |
533 | { | 533 | { |
534 | int len, i; | 534 | int len, i; |
535 | 535 | ||
536 | len = sprintf(buf, "%c", prefix); | 536 | len = snprintf(buf, size, "%c", prefix); |
537 | for (i = min; i < max; i++) | 537 | for (i = min; i < max; i++) |
538 | if (arr[LONG(i)] & BIT(i)) | 538 | if (arr[LONG(i)] & BIT(i)) |
539 | len += sprintf(buf+len, "%X,", i); | 539 | len += snprintf(buf + len, size - len, "%X,", i); |
540 | return len; | 540 | return len; |
541 | } | 541 | } |
542 | 542 | ||
543 | static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf) | 543 | static int print_modalias(char *buf, int size, struct input_dev *id) |
544 | { | 544 | { |
545 | struct input_dev *id = to_input_dev(dev); | 545 | int len; |
546 | ssize_t len = 0; | ||
547 | 546 | ||
548 | len += sprintf(buf+len, "input:b%04Xv%04Xp%04Xe%04X-", | 547 | len = snprintf(buf, size, "input:b%04Xv%04Xp%04Xe%04X-", |
549 | id->id.bustype, | 548 | id->id.bustype, |
550 | id->id.vendor, | 549 | id->id.vendor, |
551 | id->id.product, | 550 | id->id.product, |
552 | id->id.version); | 551 | id->id.version); |
553 | 552 | ||
554 | len += print_modalias_bits(buf+len, 'e', id->evbit, 0, EV_MAX); | 553 | len += print_modalias_bits(buf + len, size - len, 'e', id->evbit, |
555 | len += print_modalias_bits(buf+len, 'k', id->keybit, | 554 | 0, EV_MAX); |
555 | len += print_modalias_bits(buf + len, size - len, 'k', id->keybit, | ||
556 | KEY_MIN_INTERESTING, KEY_MAX); | 556 | KEY_MIN_INTERESTING, KEY_MAX); |
557 | len += print_modalias_bits(buf+len, 'r', id->relbit, 0, REL_MAX); | 557 | len += print_modalias_bits(buf + len, size - len, 'r', id->relbit, |
558 | len += print_modalias_bits(buf+len, 'a', id->absbit, 0, ABS_MAX); | 558 | 0, REL_MAX); |
559 | len += print_modalias_bits(buf+len, 'm', id->mscbit, 0, MSC_MAX); | 559 | len += print_modalias_bits(buf + len, size - len, 'a', id->absbit, |
560 | len += print_modalias_bits(buf+len, 'l', id->ledbit, 0, LED_MAX); | 560 | 0, ABS_MAX); |
561 | len += print_modalias_bits(buf+len, 's', id->sndbit, 0, SND_MAX); | 561 | len += print_modalias_bits(buf + len, size - len, 'm', id->mscbit, |
562 | len += print_modalias_bits(buf+len, 'f', id->ffbit, 0, FF_MAX); | 562 | 0, MSC_MAX); |
563 | len += print_modalias_bits(buf+len, 'w', id->swbit, 0, SW_MAX); | 563 | len += print_modalias_bits(buf + len, size - len, 'l', id->ledbit, |
564 | len += sprintf(buf+len, "\n"); | 564 | 0, LED_MAX); |
565 | len += print_modalias_bits(buf + len, size - len, 's', id->sndbit, | ||
566 | 0, SND_MAX); | ||
567 | len += print_modalias_bits(buf + len, size - len, 'f', id->ffbit, | ||
568 | 0, FF_MAX); | ||
569 | len += print_modalias_bits(buf + len, size - len, 'w', id->swbit, | ||
570 | 0, SW_MAX); | ||
571 | return len; | ||
572 | } | ||
573 | |||
574 | static ssize_t input_dev_show_modalias(struct class_device *dev, char *buf) | ||
575 | { | ||
576 | struct input_dev *id = to_input_dev(dev); | ||
577 | ssize_t len; | ||
578 | |||
579 | len = print_modalias(buf, PAGE_SIZE, id); | ||
580 | len += snprintf(buf + len, PAGE_SIZE-len, "\n"); | ||
565 | return len; | 581 | return len; |
566 | } | 582 | } |
567 | static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); | 583 | static CLASS_DEVICE_ATTR(modalias, S_IRUGO, input_dev_show_modalias, NULL); |
@@ -728,8 +744,11 @@ static int input_dev_uevent(struct class_device *cdev, char **envp, | |||
728 | if (test_bit(EV_SW, dev->evbit)) | 744 | if (test_bit(EV_SW, dev->evbit)) |
729 | INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX); | 745 | INPUT_ADD_HOTPLUG_BM_VAR("SW=", dev->swbit, SW_MAX); |
730 | 746 | ||
731 | envp[i] = NULL; | 747 | envp[i++] = buffer + len; |
748 | len += snprintf(buffer + len, buffer_size - len, "MODALIAS="); | ||
749 | len += print_modalias(buffer + len, buffer_size - len, dev) + 1; | ||
732 | 750 | ||
751 | envp[i] = NULL; | ||
733 | return 0; | 752 | return 0; |
734 | } | 753 | } |
735 | 754 | ||