Okay, here's where we've landed for v1:
- Power button
- Wired to GPIO3, the default for
gpio-shutdown
- When pressed, does a safe shutdown
- Wired to GPIO3, the default for
- Green power LED
- Wired to GPIO23
- Lights up green when the RPi powers on
- Reset button
- Wired to RUN using a test point pin
- Hard resets the Pi
- Also boots the Pi if a safe shutdown was performed but power is still present
- Programmer's button
- Wired to GPIO22
- Available for programmatic use
- Yellow sleep LED
- Wired to GPIO24
- Available for programmatic use
- Front speaker
- Connected to amp left channel, amp connected to TRRS jack
- "frontspeaker" composite mono ALSA device available
- "Front Speaker Output" mono PulseAudio device available, selectable for "AV Jack" in LXDE PulseAudio volume control widget
- Plays Power Mac G4 startup sound on boot (after Linux initializes the sound device, which is actually pretty late in the boot process)
- DVD drive
- Connected to USB 3.0 port
- Reports as
Bus 02.Port 2: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
- Zip disk slot
- Replaced with SSD bay
- Connected to USB 3.0 port
- Reports as
Bus 02.Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M
- PSU
- Connected to ATX PSU switch to control power
- Powering the RPi4 from a molex connector 5V line to USB-C
- Power appears stable while running
sysbench
- Power appears stable while running
- Powering the amp from a molex connector 5V line to bare wires
Here's the software configuration:
/opt/4.wav
/etc/asound.conf
/etc/systemd/system/bootsound.service
/home/pi/sawtoothg4.py
(for testing the programmer's button and yellow LED)/boot/config.txt
/usr/share/pulseaudio/alsa-mixer/profile-sets/sawtoothg4-frontspeaker.conf
/etc/udev/rules.d/91-pulseaudio-rpi.rules
(this is a copy of/lib/udev/rules.d/91-pulseaudio-rpi.rules
to override it)
Todo:
- Plug the old I/O ports
- Bring out the two USB 2.0 jacks
- Bring out the two HDMI jacks
- Bring out the ethernet jack
- Bring out the ATX PSU switch, although this will go away in a v2
Credits:
- Specs: https://everymac.com/systems/apple/powermac_g4/specs/powermac_g4_450.html
- Front panel pinout: https://www.tonymacx86.com/threads/pinout-and-circuit-for-the-g4-sawtooth-switch-cable.50357/
- Front panel pinout: https://forums.macrumors.com/threads/g4-power-switch-panel-pinout.417971/
- PSU pinout: http://atxg4.com/sawtooth.html
- Manual: http://web.archive.org/web/20050329115144/https://manuals.info.apple.com/en/PowerMacG4_PCI-AGPSetup.pdf
- Speaker: https://www.reddit.com/r/hackintosh/comments/1ezmih/anyone_install_an_internal_speaker_in_their/ca6cvi4/
- Speaker: https://www.ebay.com/itm/815-2915-REGAL-APPLE-IMAC-G4-EMC1843-POWERMAC-8-OHMS-2W-INTERNAL-SPEAKER-/223896561604
- DVD: https://www.pioneerelectronics.com/PUSA/Professional/Computer-Drives/DVR-111D
- Identifying power and ground speaker wires: https://soundcertified.com/speaker-wiring-diagram-guide/
- ALSA configuration: http://pi.eggum.net/2013/09/airplay-or-shairport-that-is.html
- ALSA configuration: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=33431
- Testing audio: https://learn.adafruit.com/usb-audio-cards-with-a-raspberry-pi/testing-audio
- Startup chime: https://forums.macrumors.com/threads/mac-startup-sound-in-wav-format.618119/
- Play chime on boot: https://www.reddit.com/r/raspberry_pi/comments/15m3cy/play_startup_sound_systemd/
- Play chime on boot: https://www.raspberrypi.org/documentation/computers/using_linux.html#creating-a-service
pi@rpi4sawtooth:~ $ cat /etc/asound.conf
pcm.card1 {
type hw
card 1
}
ctl.card1 {
type hw
card 1
}
pcm.frontspeaker {
slave.pcm card1
slave.channels 2
# type plug
type route
ttable {
# Copy both input channels to output channel 0 (Left).
0.0 0.5
1.0 0.5
# Send nothing to output channel 1 (Right).
0.1 0
1.1 0
}
}
ctl.frontspeaker {
type hw
card 1
}
#pcm.!default monocard
pi@rpi4sawtooth:~ $ cat /etc/systemd/system/bootsound.service
[Unit]
Description=Boot Sound
Wants=sound.target
After=sound.target
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/bin/aplay /opt/4.wav -D frontspeaker -q
[Install]
WantedBy=multi-user.target
pi@rpi4sawtooth:~ $ cat /home/pi/sawtoothg4/sawtoothg4.py
#!/usr/bin/env python3
import gpiozero
import signal
# Run as root to output to the HDMI display, otherwise will output locally
hdmi = None
try:
hdmi = open("/dev/console", "w")
except:
pass
def hello_programmers():
print("Programmer's button", file=hdmi)
yellow.toggle()
programmers = gpiozero.Button(22)
yellow = gpiozero.LED(24)
programmers.when_pressed = hello_programmers
signal.pause()
pi@rpi4sawtooth:~ $ tail /boot/config.txt
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
[all]
#dtoverlay=vc4-fkms-v3d
dtoverlay=gpio-shutdown
gpio=23=op,dh
pi@rpi4sawtooth:~ $ cat /usr/share/pulseaudio/alsa-mixer/profile-sets/sawtoothg4-frontspeaker.conf
[General]
auto-profiles = yes
[Mapping front-speaker]
description = Front Speaker
device-strings = hw:%f
fallback = yes
priority = 1
direction = output
channel-map = mono,mono
paths-output = analog-output
pi@rpi4sawtooth:~ $ cat /etc/udev/rules.d/91-pulseaudio-rpi.rules
SUBSYSTEM!="sound*", GOTO="end"
ACTION!="change", GOTO="end"
KERNEL!="card*", GOTO="end"
ENV{SOUND_FORM_FACTOR}!="internal", GOTO="end"
DRIVERS=="bcm2835_audio", ATTR{id}=="b1", ENV{PULSE_PROFILE_SET}="rpi-hdmi.conf", GOTO="end"
DRIVERS=="bcm2835_audio", ATTR{id}=="b2", ENV{PULSE_PROFILE_SET}="rpi-hdmi.conf", GOTO="end"
DRIVERS=="bcm2835_audio", ATTR{id}=="Headphones", ENV{PULSE_PROFILE_SET}="sawtoothg4-frontspeaker.conf", GOTO="end"
LABEL="end"
pi@rpi4sawtooth:~ $