Port-macppc archive

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

Re: Power button on G5 mac



Hello,

On Tue, 7 Jun 2022 17:18:23 +0200
Martin Husemann <martin%duskware.de@localhost> wrote:

> On Mon, Jun 06, 2022 at 09:22:54PM +0200, Martin Husemann wrote:
> > Hey folks,
> > 
> > the power button on my G5 (pmac7,3) machine does not cause sysmon/powerd
> > events and I wonder how to fix that.  
> 
> I found pmu(4) and it seems like it is supposed to already deal with
> this, but somehow does not work on my machine. I'll enable debug output
> and check what is going wrong.

IIRC on core99 we get an 'environmental' message from the PMU when the
power button is pressed. There is some filtering in that code since,
apple being apple, it does slightly different things on different
models. I'd start with dumping those messages and see what exactly the
thing sends and which we probably misinterpret.

For example:
	/*
	 * core99 PowerMacs like to send environment messages with the lid
	 * switch bit set - since that doesn't make any sense here and it
	 * probably means something else anyway we mask it out
	 */

	if (OF_getprop(root_node, "model", model, 32) != 0) {
		if (strncmp(model, "PowerMac", 8) == 0) {
			sc->sc_env_mask = PMU_ENV_POWER_BUTTON;
		}
	}

I would just enable this block, otherwise you'll get a lot of unrelated
spam:
	if (resp[1] & PMU_INT_ENVIRONMENT) {
		uint8_t diff;
#ifdef PMU_VERBOSE
		/* deal with environment messages */
		printf("environment:");
		for (i = 2; i < len; i++)
			printf(" %02x", resp[i]);
		printf("\n");
#endif

the filtering is in the next line:
		diff = (resp[2] ^ sc->sc_env_old ) & sc->sc_env_mask;

have fun
Michael


Home | Main Index | Thread Index | Old Index