Thread: mac-mini power button
Brought to you by:
matthiasgrimm
|
From: pix <pi...@te...> - 2005-09-15 07:59:50
|
hi, i was trying to get pbbuttons to detect the mac-mini power button. by running: od -t x1 -w1 /dev/pmu i could see that on pressing the power button, the bytes [0x40 0x0c] are generated. when you release the button, [0x40 0x04] is generated. i tried adding this to the module_pmac.c file, but then i noticed a bigger problem. it appears that when running on the mac mini, pbbuttonsd doesn't even listen to /dev/pmu. to check, i turned on PMUINTR in debug.h and compiled with -DDEBUG. i get a lot more debug info, but i don't get the expected line printing out the bytes that i know are being generated at /dev/pmu... so i assume somewhere during startup, pbbutons makes some decision not to monitor /dev/pmu.. possibly because it doesn't support many laptop-like functions, such as sleeping (this is also why pmud doesn't want to start on the mac-mini). anyhow, i have resorted to writing a small program which does nothing but monitor /dev/pmu, and hand off any read bytes to a script, which then halts the machine is the power button is pressed. it is available here... http://f0.am/darcs/lyta/system/pmumon/ the install rule is very debian-centric, sorry. also, the rcd script included sets server_mode in /proc/pmu/options, which is something very peculiar to our setup here, and possibly isn't what you want. it would probably be better for this *cough* feature to be incorporated into pbbuttonsd, but it seems a few people are trying to get their mac-mini power buttons to work like this, so i've made this available. i hope this is useful for the developers, unless there is some policy about not supporting desktop machines... pix. |
|
From: Matthias G. <mat...@us...> - 2005-09-29 21:16:15
|
On Thu, 15 Sep 2005 10:01:43 +0200
pix <pi...@te...> wrote:
> i could see that on pressing the power button, the bytes [0x40 0x0c] are
> generated. when you release the button, [0x40 0x04] is generated.
>
> i tried adding this to the module_pmac.c file, but then i noticed a
> bigger problem. it appears that when running on the mac mini, pbbuttonsd
> doesn't even listen to /dev/pmu. to check, i turned on PMUINTR in
> debug.h and compiled with -DDEBUG. i get a lot more debug info, but i
> don't get the expected line printing out the bytes that i know are being
> generated at /dev/pmu... so i assume somewhere during startup, pbbutons
> makes some decision not to monitor /dev/pmu.. possibly because it
> doesn't support many laptop-like functions, such as sleeping (this is
> also why pmud doesn't want to start on the mac-mini).
There is no check for desktop or laptop in pbbuttonsd. As long
as /dev/pmu could be opened it would always be read (check permissions
on /dev/pmu and your logs for pbbuttonsd error messages). Could you
send me the debug output?
> i hope this is useful for the developers, unless there is some policy
> about not supporting desktop machines...
Such a policy doesn't exist. If something doesn't work, we make it work.
Best Regards
Matthias
|
|
From: Matthias G. <mat...@us...> - 2005-10-02 21:52:23
|
On Thu, 15 Sep 2005 10:01:43 +0200 pix <pi...@te...> wrote: > hi, > > i was trying to get pbbuttons to detect the mac-mini power button. by > running: > > od -t x1 -w1 /dev/pmu > > i could see that on pressing the power button, the bytes [0x40 0x0c] are > generated. when you release the button, [0x40 0x04] is generated. I checked the pmu polling routine of pbbuttonsd again and saw that your power button should already work if the pmu message is 6 bytes long. How much bytes will be send by the pmu? Only two you wrote in the mail or more? In case it sends 6 Bytes pbbuttonsd generates the fake keycode 116 for the power key. This keycode can then be used inside pbbuttonsd. Set Sleepkey = 116 and it should work. If your PMU only sends two bytes, I have to patch pbbuttonsd. Please send me the contents of /proc/pmu/*. Best Regards Matthias > i tried adding this to the module_pmac.c file, but then i noticed a > bigger problem. it appears that when running on the mac mini, pbbuttonsd > doesn't even listen to /dev/pmu. to check, i turned on PMUINTR in > debug.h and compiled with -DDEBUG. i get a lot more debug info, but i > don't get the expected line printing out the bytes that i know are being > generated at /dev/pmu... so i assume somewhere during startup, pbbutons > makes some decision not to monitor /dev/pmu.. possibly because it > doesn't support many laptop-like functions, such as sleeping (this is > also why pmud doesn't want to start on the mac-mini). > > anyhow, i have resorted to writing a small program which does nothing > but monitor /dev/pmu, and hand off any read bytes to a script, which > then halts the machine is the power button is pressed. > > it is available here... http://f0.am/darcs/lyta/system/pmumon/ the > install rule is very debian-centric, sorry. also, the rcd script > included sets server_mode in /proc/pmu/options, which is something very > peculiar to our setup here, and possibly isn't what you want. > > it would probably be better for this *cough* feature to be incorporated > into pbbuttonsd, but it seems a few people are trying to get their > mac-mini power buttons to work like this, so i've made this available. > > i hope this is useful for the developers, unless there is some policy > about not supporting desktop machines... > > pix. > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. > Download it for free - -and be entered to win a 42" plasma tv or your very > own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > pbbuttons-users mailing list > pbb...@li... > https://lists.sourceforge.net/lists/listinfo/pbbuttons-users > |