acpi_dock(4): Notify devd(8) on dock status change

If devd(8) is running, it notifies devd(8) when the computer is docked and
undocked.

Original patch taken from:
https://people.freebsd.org/~iwasaki/acpi/acpi_dock_devd-20080204.diff
parent 4616fcd6
......@@ -257,10 +257,12 @@ static void
acpi_dock_insert(device_t dev)
{
struct acpi_dock_softc *sc;
ACPI_HANDLE h;
ACPI_SERIAL_ASSERT(dock);
sc = device_get_softc(dev);
h = acpi_get_handle(dev);
if (sc->status == ACPI_DOCK_STATUS_UNDOCKED ||
sc->status == ACPI_DOCK_STATUS_UNKNOWN) {
......@@ -270,8 +272,14 @@ acpi_dock_insert(device_t dev)
return;
}
if (!cold)
if (!cold) {
acpi_dock_insert_children(dev);
/* Notify devd(8) that we're docked */
if (devctl_process_running())
acpi_UserNotify("Dock", h, 1);
}
sc->status = ACPI_DOCK_STATUS_DOCKED;
}
}
......@@ -325,10 +333,13 @@ static void
acpi_dock_removal(device_t dev)
{
struct acpi_dock_softc *sc;
ACPI_HANDLE h;
ACPI_SERIAL_ASSERT(dock);
sc = device_get_softc(dev);
h = acpi_get_handle(dev);
if (sc->status == ACPI_DOCK_STATUS_DOCKED ||
sc->status == ACPI_DOCK_STATUS_UNKNOWN) {
acpi_dock_eject_children(dev);
......@@ -342,6 +353,10 @@ acpi_dock_removal(device_t dev)
return;
}
/* Notify devd(8) that we're undocked */
if (devctl_process_running())
acpi_UserNotify("Dock", h, 0);
sc->status = ACPI_DOCK_STATUS_UNDOCKED;
}
......@@ -534,4 +549,3 @@ static devclass_t acpi_dock_devclass;
DRIVER_MODULE(acpi_dock, acpi, acpi_dock_driver, acpi_dock_devclass, 0, 0);
MODULE_DEPEND(acpi_dock, acpi, 1, 1, 1);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment