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

Re: Setting power-on time on PowerMac



On Sun, Sep 20, 2020 at 06:29:55PM -0400, Charles E. Lehner wrote:
> I'm trying to see if I can make my computer start up on a schedule. I
> found the bootsched program for this purpose in the pmac-utils package
> in Debian Ports. But it doesn't work on my computers; it outputs
> "bootsched: write returned -1". Here is relevant output from strace:
> 
> $ sudo strace bootsched +10m
> ...
> openat(AT_FDCWD, "/dev/adb", O_RDWR)    = 3
> write(3, "\1\3", 2)                     = 2
> read(3, "\1\0\3\333\215i\332", 16)      = 7
> write(3, "\1\v\333\215l2", 6)           = -1 EINVAL (Invalid argument)
> write(2, "bootsched: write returned -1\n", 29bootsched: write returned -1
> ) = 29
> exit_group(1)                           = ?
> 
> $ uname -a
> Linux crabapple 5.8.0-1-powerpc #1 Debian 5.8.7-1 (2020-09-05) ppc GNU/Linux
> 
> This is on a PowerBook G4 12", and I also see the same on a iMac G4 17".
> 
> Does anyone have ideas for how to make this work?

This utility is abusing /dev/adb not to send an actual ADB message
but instead to talk to the driver which owns ADB on the current
system. The only mesage type all ADB drivers are required to handle
is ADB_PACKET (which is message type 0x0). In fact, three of the
five ADB drivers in the kernel only know about ADB_PACKET. The
first byte of the write is the message type, and the rest is the
message content. I suppose it's not abuse since the driver was
specifically written to allow this, but it still seems a little
non-intuitive to use this device for something that's not ADB.

That program is sending a raw Cuda command (message type 0x1), so
it will only work on systems that have Cuda whereas your PowerBook
would have PMU instead.  The PMU driver emulates Cuda request 0x3
(CUDA_GET_TIME) but doesn't emulate the more complex call being made
to set the boot time (0xb which is CUDA_POWERUP_TIME). I don't see
any indication the PMU is even capable of this functionality. My
guess is that there isn't any way to make this work on your system.

The hardware targeted by this program was only in desktop models,
and not all desktop Macs have it either. That chip was introduced
late in the m68k time frame and discontinued about the time Apple
switched to AGP video cards. That iMac would be too new to still
have Cuda and would instead also have PMU just like the PowerBook.

	Brad Boyer
	flar@allandria.com


Reply to: