Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ukbd power management?



Arto Huusko wrote:
Hello,

what needs to be done in order to add power management
support to ukbd?

I have a laptop I mainly use in office that has ukbd
attached always, but I would still like to make it
sleep when I'm away. Same goes for my home desktop
machine (which also fails to sleep because of ixpide).

The attached patch should be sufficient for ukbd. Can you verify?

Cheers,
Jared
Index: ukbd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ukbd.c,v
retrieving revision 1.100
diff -u -r1.100 ukbd.c
--- ukbd.c      24 May 2008 16:40:58 -0000      1.100
+++ ukbd.c      3 Sep 2008 21:29:20 -0000
@@ -312,6 +312,11 @@
        sc->sc_hdev.sc_parent = uha->parent;
        sc->sc_hdev.sc_report_id = uha->reportid;
 
+       if (!pmf_device_register(self, NULL, NULL)) {
+               aprint_normal("\n");
+               aprint_error_dev(self, "couldn't establish power handler\n");
+       }
+
        parseerr = ukbd_parse_desc(sc);
        if (parseerr != NULL) {
                aprint_normal("\n");
@@ -325,7 +330,6 @@
 #endif
        aprint_normal("\n");
 
-
        qflags = usbd_get_quirks(uha->parent->sc_udev)->uq_flags;
        sc->sc_debounce = (qflags & UQ_SPUR_BUT_UP) != 0;
 
@@ -433,6 +437,8 @@
 
        DPRINTF(("ukbd_detach: sc=%p flags=%d\n", sc, flags));
 
+       pmf_device_deregister(self);
+
        if (sc->sc_console_keyboard) {
 #if 0
                /*


Home | Main Index | Thread Index | Old Index