diff -r -c original/acpi_drivers.h new/acpi_drivers.h *** original/acpi_drivers.h Mon Dec 9 15:01:10 2002 --- new/acpi_drivers.h Wed Dec 18 14:12:46 2002 *************** *** 86,91 **** --- 86,92 ---- #define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver" #define ACPI_BUTTON_CLASS "button" #define ACPI_BUTTON_FILE_INFO "info" + #define ACPI_BUTTON_FILE_STATE "state" #define ACPI_BUTTON_TYPE_UNKNOWN 0x00 #define ACPI_BUTTON_NOTIFY_STATUS 0x80 diff -r -c original/button.c new/button.c *** original/button.c Mon Dec 9 11:13:45 2002 --- new/button.c Thu Dec 19 08:17:35 2002 *************** *** 102,107 **** --- 102,145 ---- return_VALUE(len); } + static int + acpi_button_lid_read_state( + char *page, + char **start, + off_t off, + int count, + int *eof, + void *data) + { + struct acpi_button *button = (struct acpi_button *) data; + char *p = page; + int len = 0; + acpi_status status=AE_OK; + unsigned long state; + + ACPI_FUNCTION_TRACE("acpi_button_lid_read_state"); + + if (!button || !button->device) + goto end; + + status=acpi_evaluate_integer(button->handle,"_LID",NULL,&state); + if (ACPI_FAILURE(status)){ + p += sprintf(p, "state: unsupported\n"); + } + else{ + p += sprintf(p, "state: %lu\n",state); + } + + end: + len = (p - page); + if (len <= off+count) *eof = 1; + *start = page + off; + len -= off; + if (len>count) len = count; + if (len<0) len = 0; + + return_VALUE(len); + } static int acpi_button_add_fs ( *************** *** 148,153 **** --- 186,205 ---- else { entry->read_proc = acpi_button_read_info; entry->data = acpi_driver_data(device); + } + + if (button->type==ACPI_BUTTON_TYPE_LID){ + /* 'state' [R] */ + entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, + S_IRUGO, acpi_device_dir(device)); + if (!entry) + ACPI_DEBUG_PRINT((ACPI_DB_ERROR, + "Unable to create '%s' fs entry\n", + ACPI_BUTTON_FILE_STATE)); + else { + entry->read_proc = acpi_button_lid_read_state; + entry->data = acpi_driver_data(device); + } } return_VALUE(0);