Skip to content

Instantly share code, notes, and snippets.

@xqms
Created September 21, 2011 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xqms/1230801 to your computer and use it in GitHub Desktop.
Save xqms/1230801 to your computer and use it in GitHub Desktop.
static void eject_dock(struct dock_station *ds)
{
struct acpi_object_list arg_list;
union acpi_object arg;
acpi_status status;
acpi_handle tmp;
/* all dock devices should have _EJ0, but check anyway */
status = acpi_get_handle(ds->handle, "_EJ0", &tmp);
if (ACPI_FAILURE(status)) {
pr_debug("No _EJ0 support for dock device\n");
return;
}
arg_list.count = 1;
arg_list.pointer = &arg;
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = 1;
status = acpi_evaluate_object(ds->handle, "_EJ0", &arg_list, NULL);
if (ACPI_FAILURE(status))
pr_debug("Failed to evaluate _EJ0!\n");
}
Method (_EJ0, 1, NotSerialized)
{
\_SB.PCI0.LPC.EC.BEJ0 (Arg0)
}
Method (BEJ0, 1, NotSerialized)
{
If (Arg0)
{
BDIS ()
LED (0x04, 0x00)
\BHDP (0x01, 0x00)
Store (0x01, BSTS)
If (BHKE)
{
Store (0x00, BHKE)
\_SB.PCI0.LPC.EC.HKEY.MHKQ (0x3003)
}
}
Else
{
LED (0x04, 0x80)
Store (0x00, BSTS)
}
}
Method (BDIS, 0, NotSerialized)
{
If (LNot (\_SB.PCI0.LPC.CSON))
{
Store (0x01, \_SB.PCI0.LPC.CSON)
Store (0x0F, \IDET)
}
}
Method (BPON, 1, NotSerialized)
{
If (\_SB.PCI0.LPC.CSON)
{
Store (0x00, \_SB.PCI0.LPC.CSON)
}
}
echo undock > /sys/devices/platform/dock.2/undock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment