Lines 13-19
Link Here
|
13 |
#include <errno.h> |
13 |
#include <errno.h> |
14 |
|
14 |
|
15 |
#define ACPI_SOCKET "/var/run/acpid.socket" |
15 |
#define ACPI_SOCKET "/var/run/acpid.socket" |
16 |
#define ACPI_EVENTS "/proc/acpi/event" |
|
|
17 |
|
16 |
|
18 |
#define ACPI_VIDEO_NOTIFY_SWITCH 0x80 |
17 |
#define ACPI_VIDEO_NOTIFY_SWITCH 0x80 |
19 |
#define ACPI_VIDEO_NOTIFY_PROBE 0x81 |
18 |
#define ACPI_VIDEO_NOTIFY_PROBE 0x81 |
Lines 46-51
Link Here
|
46 |
|
45 |
|
47 |
n = read( fd, ev, LINE_LENGTH ); |
46 |
n = read( fd, ev, LINE_LENGTH ); |
48 |
|
47 |
|
|
|
48 |
if (n <= 0) { |
49 |
lnxCloseACPI(); |
50 |
lnxACPIOpen(); |
51 |
return 0; |
52 |
} |
53 |
|
49 |
/* Check that we have a video event */ |
54 |
/* Check that we have a video event */ |
50 |
if (strstr(ev, "video") == ev) { |
55 |
if (strstr(ev, "video") == ev) { |
51 |
char *video = NULL; |
56 |
char *video = NULL; |
Lines 130-152
Link Here
|
130 |
strcpy(addr.sun_path, ACPI_SOCKET); |
135 |
strcpy(addr.sun_path, ACPI_SOCKET); |
131 |
if ((r = connect(fd, (struct sockaddr*)&addr, sizeof(addr))) == -1) { |
136 |
if ((r = connect(fd, (struct sockaddr*)&addr, sizeof(addr))) == -1) { |
132 |
shutdown(fd, 2); |
137 |
shutdown(fd, 2); |
133 |
fd = -1; |
138 |
xf86MsgVerb(X_WARNING,3,"Open ACPI failed (%s) (%s)\n", ACPI_SOCKET, |
134 |
} |
|
|
135 |
} |
136 |
|
137 |
/* acpid's socket isn't available, so try going direct */ |
138 |
if (fd == -1) { |
139 |
if ((fd = open(ACPI_EVENTS, O_RDONLY)) < 0) { |
140 |
xf86MsgVerb(X_WARNING,3,"Open ACPI failed (%s) (%s)\n", ACPI_EVENTS, |
141 |
strerror(errno)); |
139 |
strerror(errno)); |
142 |
return NULL; |
140 |
return NULL; |
143 |
} |
141 |
} |
144 |
} |
142 |
} |
145 |
|
143 |
|
146 |
xf86PMGetEventFromOs = lnxACPIGetEventFromOs; |
144 |
xf86PMGetEventFromOs = lnxACPIGetEventFromOs; |
147 |
xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs; |
145 |
xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs; |
148 |
ACPIihPtr = xf86AddInputHandler(fd,xf86HandlePMEvents,NULL); |
146 |
ACPIihPtr = xf86AddInputHandler(fd,xf86HandlePMEvents,NULL); |
149 |
xf86MsgVerb(X_INFO,3,"Open ACPI successful (%s)\n", (r != -1) ? ACPI_SOCKET : ACPI_EVENTS); |
147 |
xf86MsgVerb(X_INFO,3,"Open ACPI successful (%s)\n", ACPI_SOCKET); |
150 |
|
148 |
|
151 |
return lnxCloseACPI; |
149 |
return lnxCloseACPI; |
152 |
} |
150 |
} |