[RX51] Add support for physical events w/ acpid
This adds a way to handle physical events like keypad slide switch,
screen lock, camera lid, and others. This uses acpid from busybox (I was
wrong about the real acpid package), and anl acpi.map file to map events
to 'scripts'. The scripts are symlinked to /etc/acpi/handler.sh,
automatically by the new post-install script, where
they are handled based on which script was called. This allows for
easily adding whatever is necessary for #178.
If this PR is merged, I will create a new wiki page detailing how others
can use this framework on other devices.
There's an issue with Busybox's acpid, where it is unable to detect new
devices added after the daemon loads. This is the case on the N900,
where openrc starts acpid well before the kernel is done modprobing
drivers (e.g. gpio_keys), so it's necessary to restart the acpid daemon
after some time to 'load' the new devices.
2017-07-19 04:43:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Generate symlinks for acpid events, based on definitions in /etc/acpi.map
|
|
|
|
for i in $(awk '{if($NF && ($1 !~ /^#/)) print $NF}' /etc/acpi.map); do
|
|
|
|
ln -s /etc/acpi/handler.sh /etc/acpi/$i
|
|
|
|
done
|
|
|
|
|
|
|
|
# Enable acpid
|
|
|
|
rc-update add acpid default
|
2017-08-14 12:19:22 +00:00
|
|
|
# hwdrivers is required for acpid to 'see' all devices
|
|
|
|
rc-update add hwdrivers boot
|
|
|
|
# Enable networking service (requires /etc/interfaces, which is configured below)
|
|
|
|
rc-update add networking default
|
[RX51] Add support for physical events w/ acpid
This adds a way to handle physical events like keypad slide switch,
screen lock, camera lid, and others. This uses acpid from busybox (I was
wrong about the real acpid package), and anl acpi.map file to map events
to 'scripts'. The scripts are symlinked to /etc/acpi/handler.sh,
automatically by the new post-install script, where
they are handled based on which script was called. This allows for
easily adding whatever is necessary for #178.
If this PR is merged, I will create a new wiki page detailing how others
can use this framework on other devices.
There's an issue with Busybox's acpid, where it is unable to detect new
devices added after the daemon loads. This is the case on the N900,
where openrc starts acpid well before the kernel is done modprobing
drivers (e.g. gpio_keys), so it's necessary to restart the acpid daemon
after some time to 'load' the new devices.
2017-07-19 04:43:27 +00:00
|
|
|
|
2017-07-24 16:44:33 +00:00
|
|
|
# Add /boot mount point in fstab
|
|
|
|
if [ -z "$(grep /boot /etc/fstab)" ]; then
|
|
|
|
echo "/dev/dm-0 /boot ext2 defaults 0 0" >> /etc/fstab
|
|
|
|
fi
|
|
|
|
# Add swap to fstab & enable swap on device startup
|
|
|
|
if [ -z "$(grep /dev/mmcblk1p3 /etc/fstab)" ]; then
|
|
|
|
echo "/dev/mmcblk1p3 none swap defaults 0 0" >> /etc/fstab
|
|
|
|
fi
|
|
|
|
rc-update add swap default
|
|
|
|
|
2017-08-14 12:19:22 +00:00
|
|
|
# Set RTC device for hwclock
|
|
|
|
if [ -z "$(grep /dev/rtc0 /etc/conf.d/hwclock)" ]; then
|
|
|
|
sed -i 's/clock_args=\"/clock_args=\" -f \/dev\/rtc/' /etc/conf.d/hwclock
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Create /etc/network/interfaces if this doesn't exist
|
|
|
|
if [ ! -f /etc/network/interfaces ]; then
|
|
|
|
cat << EOF >> /etc/network/interfaces
|
|
|
|
auto lo
|
|
|
|
iface lo inet loopback
|
|
|
|
auto wlan0
|
|
|
|
iface wlan0 inet dhcp
|
|
|
|
EOF
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
[RX51] Add support for physical events w/ acpid
This adds a way to handle physical events like keypad slide switch,
screen lock, camera lid, and others. This uses acpid from busybox (I was
wrong about the real acpid package), and anl acpi.map file to map events
to 'scripts'. The scripts are symlinked to /etc/acpi/handler.sh,
automatically by the new post-install script, where
they are handled based on which script was called. This allows for
easily adding whatever is necessary for #178.
If this PR is merged, I will create a new wiki page detailing how others
can use this framework on other devices.
There's an issue with Busybox's acpid, where it is unable to detect new
devices added after the daemon loads. This is the case on the N900,
where openrc starts acpid well before the kernel is done modprobing
drivers (e.g. gpio_keys), so it's necessary to restart the acpid daemon
after some time to 'load' the new devices.
2017-07-19 04:43:27 +00:00
|
|
|
exit 0
|