Commit 0456c66f4e905e1ca839318219c770988b47975c
Committed by
Dmitry Torokhov
1 parent
38a1807bad
Exists in
master
and in
13 other branches
Input: serio - add firmware_id sysfs attribute
serio devices exposed via platform firmware interfaces such as ACPI may provide additional identifying information of use to userspace. We don't associate the serio devices with the firmware device (we don't set it as parent), so there's no way for userspace to make use of this information. We cannot change the parent for serio devices instantiated though a firmware interface as that would break suspend / resume ordering. Therefore this patch adds a new firmware_id sysfs attribute so that userspace can get a string from there with any additional identifying information the firmware interface may provide. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Showing 2 changed files with 15 additions and 0 deletions Side-by-side Diff
drivers/input/serio/serio.c
... | ... | @@ -451,6 +451,13 @@ |
451 | 451 | return retval; |
452 | 452 | } |
453 | 453 | |
454 | +static ssize_t firmware_id_show(struct device *dev, struct device_attribute *attr, char *buf) | |
455 | +{ | |
456 | + struct serio *serio = to_serio_port(dev); | |
457 | + | |
458 | + return sprintf(buf, "%s\n", serio->firmware_id); | |
459 | +} | |
460 | + | |
454 | 461 | static DEVICE_ATTR_RO(type); |
455 | 462 | static DEVICE_ATTR_RO(proto); |
456 | 463 | static DEVICE_ATTR_RO(id); |
457 | 464 | |
... | ... | @@ -473,12 +480,14 @@ |
473 | 480 | static DEVICE_ATTR_WO(drvctl); |
474 | 481 | static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL); |
475 | 482 | static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode); |
483 | +static DEVICE_ATTR_RO(firmware_id); | |
476 | 484 | |
477 | 485 | static struct attribute *serio_device_attrs[] = { |
478 | 486 | &dev_attr_modalias.attr, |
479 | 487 | &dev_attr_description.attr, |
480 | 488 | &dev_attr_drvctl.attr, |
481 | 489 | &dev_attr_bind_mode.attr, |
490 | + &dev_attr_firmware_id.attr, | |
482 | 491 | NULL |
483 | 492 | }; |
484 | 493 | |
485 | 494 | |
... | ... | @@ -921,8 +930,13 @@ |
921 | 930 | SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto); |
922 | 931 | SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id); |
923 | 932 | SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra); |
933 | + | |
924 | 934 | SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X", |
925 | 935 | serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); |
936 | + | |
937 | + if (serio->firmware_id[0]) | |
938 | + SERIO_ADD_UEVENT_VAR("SERIO_FIRMWARE_ID=%s", | |
939 | + serio->firmware_id); | |
926 | 940 | |
927 | 941 | return 0; |
928 | 942 | } |