Index: main.c =================================================================== RCS file: /home/cvs/ACPI/util/acpiconf/main.c,v retrieving revision 1.9 diff -u -r1.9 main.c --- main.c 2000/03/20 14:46:30 1.9 +++ main.c 2000/04/13 12:29:49 @@ -35,6 +35,7 @@ #include #include #include "name.h" +#include "obj.h" #include "amlmem.h" #include "status.h" #include "env.h" @@ -134,19 +135,58 @@ } #define ACPIDEV "/dev/acpi" +struct aml_name * find_ec(struct aml_name *name) +{ + struct aml_name *n2=NULL,*ptr; + if((strncmp(name->name,"_HID",4)==0) + &&(name->property->type==aml_t_num) + &&(name->property->num.number==0x90cd041)) + { + return name->parent; + } + + for(ptr =name->child;ptr;ptr=ptr->brother){ + if((n2=find_ec(ptr))!=NULL) + break; + } + return n2; +} +int setup_ec() +{ + struct aml_name *name,*n2; + int gpe_number,fd; + name=find_ec(get_rootname()); + if(name==NULL){ + return 0; + } + n2=search_aml_name(name,"_GPE"); + if(n2->property->type==aml_t_num){ + gpe_number=n2->property->num.number; + }else{ + return 0; + } + if((fd=open("/dev/ec",O_RDWR))<0){ + return 0; + }else{ + ioctl(fd,ACPIIO_ECGPE_SET,gpe_number); + fprintf(stderr,"ECGPE_SET to %d\n",gpe_number); + return 0; + } +} int acpi_enable() { - int fd = open(ACPIDEV, O_RDWR); + int fd = open(ACPIDEV, O_RDWR); ; if (fd == -1) err(1, NULL); - if (ioctl(fd, ACPIIO_ENABLE, NULL) == -1) err(1, NULL); - close(fd); - + + parse_dsdt(); + setup_ec(); + return 0; } @@ -289,7 +329,7 @@ if (argc == 1) { parse_dsdt(); - goto out; + goto out; } while ((c = getopt(argc, argv, "f:s:ed")) != -1) {