···134134subsystems are not documented here, nor are they tracked by this135135attribute.136136137137-Hot keys -- /proc/acpi/ibm/hotkey138138----------------------------------137137+Hot keys138138+--------139139+140140+procfs: /proc/acpi/ibm/hotkey141141+sysfs device attribute: hotkey/*139142140143Without this driver, only the Fn-F4 key (sleep button) generates an141144ACPI event. With the driver loaded, the hotkey feature enabled and the···151148All labeled Fn-Fx key combinations generate distinct events. In152149addition, the lid microswitch and some docking station buttons may153150also generate such events.154154-155155-The following commands can be written to this file:156156-157157- echo enable > /proc/acpi/ibm/hotkey -- enable the hot keys feature158158- echo disable > /proc/acpi/ibm/hotkey -- disable the hot keys feature159159- echo 0xffff > /proc/acpi/ibm/hotkey -- enable all possible hot keys160160- echo 0x0000 > /proc/acpi/ibm/hotkey -- disable all possible hot keys161161- ... any other 4-hex-digit mask ...162162- echo reset > /proc/acpi/ibm/hotkey -- restore the original mask163151164152The bit mask allows some control over which hot keys generate ACPI165153events. Not all bits in the mask can be modified. Not all bits that···182188buttons do not generate ACPI events even with this driver. They *can*183189be used through the "ThinkPad Buttons" utility, see184190http://www.nongnu.org/tpb/191191+192192+procfs notes:193193+194194+The following commands can be written to the /proc/acpi/ibm/hotkey file:195195+196196+ echo enable > /proc/acpi/ibm/hotkey -- enable the hot keys feature197197+ echo disable > /proc/acpi/ibm/hotkey -- disable the hot keys feature198198+ echo 0xffff > /proc/acpi/ibm/hotkey -- enable all possible hot keys199199+ echo 0x0000 > /proc/acpi/ibm/hotkey -- disable all possible hot keys200200+ ... any other 4-hex-digit mask ...201201+ echo reset > /proc/acpi/ibm/hotkey -- restore the original mask202202+203203+sysfs notes:204204+205205+ The hot keys attributes are in a hotkey/ subdirectory off the206206+ thinkpad device.207207+208208+ bios_enabled:209209+ Returns the status of the hot keys feature when210210+ thinkpad-acpi was loaded. Upon module unload, the hot211211+ key feature status will be restored to this value.212212+213213+ 0: hot keys were disabled214214+ 1: hot keys were enabled215215+216216+ bios_mask:217217+ Returns the hot keys mask when thinkpad-acpi was loaded.218218+ Upon module unload, the hot keys mask will be restored219219+ to this value.220220+221221+ enable:222222+ Enables/disables the hot keys feature, and reports223223+ current status of the hot keys feature.224224+225225+ 0: disables the hot keys feature / feature disabled226226+ 1: enables the hot keys feature / feature enabled227227+228228+ mask:229229+ bit mask to enable ACPI event generation for each hot230230+ key (see above). Returns the current status of the hot231231+ keys mask, and allows one to modify it.232232+185233186234Bluetooth -- /proc/acpi/ibm/bluetooth187235-------------------------------------
+127
drivers/misc/thinkpad_acpi.c
···706706static int hotkey_orig_status;707707static int hotkey_orig_mask;708708709709+static struct attribute_set *hotkey_dev_attributes = NULL;710710+711711+/* sysfs hotkey enable ------------------------------------------------- */712712+static ssize_t hotkey_enable_show(struct device *dev,713713+ struct device_attribute *attr,714714+ char *buf)715715+{716716+ int res, status, mask;717717+718718+ res = hotkey_get(&status, &mask);719719+ if (res)720720+ return res;721721+722722+ return snprintf(buf, PAGE_SIZE, "%d\n", status);723723+}724724+725725+static ssize_t hotkey_enable_store(struct device *dev,726726+ struct device_attribute *attr,727727+ const char *buf, size_t count)728728+{729729+ unsigned long t;730730+ int res, status, mask;731731+732732+ if (parse_strtoul(buf, 1, &t))733733+ return -EINVAL;734734+735735+ res = hotkey_get(&status, &mask);736736+ if (!res)737737+ res = hotkey_set(t, mask);738738+739739+ return (res) ? res : count;740740+}741741+742742+static struct device_attribute dev_attr_hotkey_enable =743743+ __ATTR(enable, S_IWUSR | S_IRUGO,744744+ hotkey_enable_show, hotkey_enable_store);745745+746746+/* sysfs hotkey mask --------------------------------------------------- */747747+static ssize_t hotkey_mask_show(struct device *dev,748748+ struct device_attribute *attr,749749+ char *buf)750750+{751751+ int res, status, mask;752752+753753+ res = hotkey_get(&status, &mask);754754+ if (res)755755+ return res;756756+757757+ return snprintf(buf, PAGE_SIZE, "0x%04x\n", mask);758758+}759759+760760+static ssize_t hotkey_mask_store(struct device *dev,761761+ struct device_attribute *attr,762762+ const char *buf, size_t count)763763+{764764+ unsigned long t;765765+ int res, status, mask;766766+767767+ if (parse_strtoul(buf, 0xffff, &t))768768+ return -EINVAL;769769+770770+ res = hotkey_get(&status, &mask);771771+ if (!res)772772+ hotkey_set(status, t);773773+774774+ return (res) ? res : count;775775+}776776+777777+static struct device_attribute dev_attr_hotkey_mask =778778+ __ATTR(mask, S_IWUSR | S_IRUGO,779779+ hotkey_mask_show, hotkey_mask_store);780780+781781+/* sysfs hotkey bios_enabled ------------------------------------------- */782782+static ssize_t hotkey_bios_enabled_show(struct device *dev,783783+ struct device_attribute *attr,784784+ char *buf)785785+{786786+ return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_orig_status);787787+}788788+789789+static struct device_attribute dev_attr_hotkey_bios_enabled =790790+ __ATTR(bios_enabled, S_IRUGO, hotkey_bios_enabled_show, NULL);791791+792792+/* sysfs hotkey bios_mask ---------------------------------------------- */793793+static ssize_t hotkey_bios_mask_show(struct device *dev,794794+ struct device_attribute *attr,795795+ char *buf)796796+{797797+ return snprintf(buf, PAGE_SIZE, "0x%04x\n", hotkey_orig_mask);798798+}799799+800800+static struct device_attribute dev_attr_hotkey_bios_mask =801801+ __ATTR(bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL);802802+803803+/* --------------------------------------------------------------------- */804804+805805+static struct attribute *hotkey_mask_attributes[] = {806806+ &dev_attr_hotkey_mask.attr,807807+ &dev_attr_hotkey_bios_enabled.attr,808808+ &dev_attr_hotkey_bios_mask.attr,809809+};810810+709811static int __init hotkey_init(struct ibm_init_struct *iibm)710812{711813 int res;···824722 str_supported(tp_features.hotkey));825723826724 if (tp_features.hotkey) {725725+ hotkey_dev_attributes = create_attr_set(4,726726+ TPACPI_HOTKEY_SYSFS_GROUP);727727+ if (!hotkey_dev_attributes)728728+ return -ENOMEM;729729+ res = add_to_attr_set(hotkey_dev_attributes,730730+ &dev_attr_hotkey_enable.attr);731731+ if (res)732732+ return res;733733+827734 /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,828735 A30, R30, R31, T20-22, X20-21, X22-24 */829736 tp_features.hotkey_mask =···842731 str_supported(tp_features.hotkey_mask));843732844733 res = hotkey_get(&hotkey_orig_status, &hotkey_orig_mask);734734+ if (!res && tp_features.hotkey_mask) {735735+ res = add_many_to_attr_set(hotkey_dev_attributes,736736+ hotkey_mask_attributes,737737+ ARRAY_SIZE(hotkey_mask_attributes));738738+ }739739+ if (!res)740740+ res = register_attr_set_with_sysfs(741741+ hotkey_dev_attributes,742742+ &tpacpi_pdev->dev.kobj);743743+845744 if (res)846745 return res;847746 }···868747 res = hotkey_set(hotkey_orig_status, hotkey_orig_mask);869748 if (res)870749 printk(IBM_ERR "failed to restore hotkey to BIOS defaults\n");750750+ }751751+752752+ if (hotkey_dev_attributes) {753753+ delete_attr_set(hotkey_dev_attributes, &tpacpi_pdev->dev.kobj);754754+ hotkey_dev_attributes = NULL;871755 }872756}873757···924798 return 0;925799}926800801801+/* procfs -------------------------------------------------------------- */927802static int hotkey_read(char *p)928803{929804 int res, status, mask;
+2
drivers/misc/thinkpad_acpi.h
···414414 * Hotkey subdriver415415 */416416417417+#define TPACPI_HOTKEY_SYSFS_GROUP "hotkey"418418+417419static int hotkey_orig_status;418420static int hotkey_orig_mask;419421