* Add mising static's to button.c
@ 2002-12-18 22:11 Pavel Machek
2002-12-19 7:29 ` LID state Zdeněk OGAR Skalák
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Machek @ 2002-12-18 22:11 UTC (permalink / raw)
To: Andrew Grover, ACPI mailing list
Hi!
Should be obvious, please apply,
Pavel
--- clean/drivers/acpi/button.c 2002-11-29 21:16:33.000000000 +0100
+++ linux-sensors/drivers/acpi/button.c 2002-12-16 23:20:15.000000000 +0100
@@ -68,8 +68,8 @@
MODULE_LICENSE("GPL");
-int acpi_button_add (struct acpi_device *device);
-int acpi_button_remove (struct acpi_device *device, int type);
+static int acpi_button_add (struct acpi_device *device);
+static int acpi_button_remove (struct acpi_device *device, int type);
static int acpi_button_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_button_driver = {
@@ -234,7 +234,7 @@
}
-int
+static int
acpi_button_add (
struct acpi_device *device)
{
@@ -384,7 +384,7 @@
}
-int
+static int
acpi_button_remove (struct acpi_device *device, int type)
{
acpi_status status = 0;
--
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?
-------------------------------------------------------
This SF.NET email is sponsored by: Order your Holiday Geek Presents Now!
Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap,
MP3 Players, XBox Games, Flying Saucers, WebCams, Smart Putty.
T H I N K G E E K . C O M http://www.thinkgeek.com/sf/
^ permalink raw reply [flat|nested] 2+ messages in thread* LID state
2002-12-18 22:11 Add mising static's to button.c Pavel Machek
@ 2002-12-19 7:29 ` Zdeněk OGAR Skalák
0 siblings, 0 replies; 2+ messages in thread
From: Zdeněk OGAR Skalák @ 2002-12-19 7:29 UTC (permalink / raw)
Cc: Andrew Grover, ACPI mailing list
[-- Attachment #1: Type: text/plain, Size: 680 bytes --]
Hi,
should you try this patch? It's simple (& maybe stupid), but it adds
/proc/acpi/button/lid/*/state, which is the actual state of the lid. So you no
longer have to count events for lid :-) When the event lid happens, just ask the
state ....
It's done by acpi_evaluate_integer( "_LID" ).
This patch is for acpi-20021205 for 2.4.20. It should be applied in
drivers/acpi dir.
It modifies only acpi_drivers.h & button.c.
Don't know, if it is linux-like coded, so somebody should take a look at.
By
Zdenek OGAR Skalak
--
Ing. Zdeněk OGAR Skalák
Monet+ a.s.
Zámecká 365
763 14 Zlín - Štípa, CZ
Tel: +420 / 577 110 411, Fax: +420 / 577 914 557
[-- Attachment #2: acpi.diff --]
[-- Type: text/plain, Size: 2140 bytes --]
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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-12-19 7:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-18 22:11 Add mising static's to button.c Pavel Machek
2002-12-19 7:29 ` LID state Zdeněk OGAR Skalák
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox