forked from enlightenment/enlightenment
try and handle peoples thinkpads where acpid reports different event
formasts. e.g.: button/lid LID close as opposed to button/lid LID0 00000080 00000001 i hope normal acpi isn't broken. please test. SVN revision: 71268
This commit is contained in:
parent
fba085fcb9
commit
496577bbf8
112
src/bin/e_acpi.c
112
src/bin/e_acpi.c
|
@ -209,68 +209,74 @@ _e_acpi_cb_server_data(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||||
sdata[p - str] = 0;
|
sdata[p - str] = 0;
|
||||||
/* parse out this acpi string into separate pieces */
|
/* parse out this acpi string into separate pieces */
|
||||||
if (sscanf(sdata, "%1023s %1023s %x %x",
|
if (sscanf(sdata, "%1023s %1023s %x %x",
|
||||||
device, bus, &sig, &status) == 4)
|
device, bus, &sig, &status) != 4)
|
||||||
{
|
{
|
||||||
/* create new event structure to raise */
|
sig = -1;
|
||||||
acpi_event = E_NEW(E_Event_Acpi, 1);
|
status = -1;
|
||||||
acpi_event->bus_id = eina_stringshare_add(bus);
|
if (sscanf(sdata, "%1023s %1023s", device, bus) != 2)
|
||||||
acpi_event->signal = sig;
|
goto done_event;
|
||||||
acpi_event->status = status;
|
}
|
||||||
|
|
||||||
/* FIXME: add in a key faking layer */
|
/* create new event structure to raise */
|
||||||
if (!done)
|
acpi_event = E_NEW(E_Event_Acpi, 1);
|
||||||
{
|
acpi_event->bus_id = eina_stringshare_add(bus);
|
||||||
for (i = 0; _devices_multiplexed[i].name; i++)
|
acpi_event->signal = sig;
|
||||||
{
|
acpi_event->status = status;
|
||||||
// if device name matches
|
|
||||||
if ((!strcmp(device, _devices_multiplexed[i].name)) &&
|
/* FIXME: add in a key faking layer */
|
||||||
// AND busname not set OR device name matches
|
if ((!done) && (sig >= 0) && (status >= 0))
|
||||||
(!_devices_multiplexed[i].bus ||
|
{
|
||||||
(_devices_multiplexed[i].bus &&
|
for (i = 0; _devices_multiplexed[i].name; i++)
|
||||||
(!strcmp(bus, _devices_multiplexed[i].bus)))) &&
|
|
||||||
// AND status matches
|
|
||||||
(_devices_multiplexed[i].status == status))
|
|
||||||
{
|
|
||||||
acpi_event->type = _devices_multiplexed[i].type;
|
|
||||||
done = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!done)
|
|
||||||
{
|
{
|
||||||
// if device name matches
|
// if device name matches
|
||||||
for (i = 0; _devices_simple[i].name; i++)
|
if ((!strcmp(device, _devices_multiplexed[i].name)) &&
|
||||||
|
// AND busname not set OR device name matches
|
||||||
|
(!_devices_multiplexed[i].bus ||
|
||||||
|
(_devices_multiplexed[i].bus &&
|
||||||
|
(!strcmp(bus, _devices_multiplexed[i].bus)))) &&
|
||||||
|
// AND status matches
|
||||||
|
(_devices_multiplexed[i].status == status))
|
||||||
{
|
{
|
||||||
if (!strcmp(device, _devices_simple[i].name))
|
acpi_event->type = _devices_multiplexed[i].type;
|
||||||
{
|
done = 1;
|
||||||
acpi_event->type = _devices_simple[i].type;
|
|
||||||
done = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!done)
|
|
||||||
{
|
|
||||||
free(acpi_event);
|
|
||||||
acpi_event = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (acpi_event->type)
|
|
||||||
{
|
|
||||||
case E_ACPI_TYPE_LID:
|
|
||||||
acpi_event->status =
|
|
||||||
_e_acpi_lid_status_get(device, bus);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* actually raise the event */
|
|
||||||
ecore_event_add(E_EVENT_ACPI, acpi_event,
|
|
||||||
_e_acpi_cb_event_free, NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!done)
|
||||||
|
{
|
||||||
|
// if device name matches
|
||||||
|
for (i = 0; _devices_simple[i].name; i++)
|
||||||
|
{
|
||||||
|
if (!strcmp(device, _devices_simple[i].name))
|
||||||
|
{
|
||||||
|
acpi_event->type = _devices_simple[i].type;
|
||||||
|
done = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!done)
|
||||||
|
{
|
||||||
|
free(acpi_event);
|
||||||
|
acpi_event = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (acpi_event->type)
|
||||||
|
{
|
||||||
|
case E_ACPI_TYPE_LID:
|
||||||
|
acpi_event->status =
|
||||||
|
_e_acpi_lid_status_get(device, bus);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* actually raise the event */
|
||||||
|
ecore_event_add(E_EVENT_ACPI, acpi_event,
|
||||||
|
_e_acpi_cb_event_free, NULL);
|
||||||
|
}
|
||||||
|
done_event:
|
||||||
str = p + 1;
|
str = p + 1;
|
||||||
p = strchr(str, '\n');
|
p = strchr(str, '\n');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue