mirror of
https://github.com/marcriera/ddgo-pnp-controller.git
synced 2025-04-18 09:39:28 +02:00
Add installation scripts and files
This commit is contained in:
parent
382990f596
commit
52a4d6eb62
4 changed files with 134 additions and 0 deletions
98
dist/hook_magic_36558b710a.sh
vendored
Normal file
98
dist/hook_magic_36558b710a.sh
vendored
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Densha de Go! Plug & Play controller mod installation script
|
||||||
|
|
||||||
|
USB_ROOT="/mnt"
|
||||||
|
|
||||||
|
error_exit() {
|
||||||
|
# Blink the door light to indicate an error
|
||||||
|
echo timer > /sys/class/leds/led2/trigger
|
||||||
|
echo 100 > /sys/class/leds/led2/delay_on
|
||||||
|
echo 100 > /sys/class/leds/led2/delay_off
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
# Stop Densha de Go! game app
|
||||||
|
/etc/init.d/S99dgtype3 stop
|
||||||
|
|
||||||
|
# Light the door light to indicate we're running
|
||||||
|
echo -n none > /sys/class/leds/led2/trigger
|
||||||
|
echo 1 > /sys/class/leds/led2/brightness
|
||||||
|
|
||||||
|
# Mount partitions
|
||||||
|
mkdir /tmp/boot
|
||||||
|
if ! mount /dev/mmcblk0p6 /tmp/boot; then
|
||||||
|
echo "Failed to mount boot partition"
|
||||||
|
error_exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! mount -o remount,rw /; then
|
||||||
|
echo "Failed to remount rootfs read-write"
|
||||||
|
error_exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Backup original kernel
|
||||||
|
if [ ! -f "${USB_ROOT}/BACKUP/uImage" ]; then
|
||||||
|
if ! cp /tmp/boot/uImage "${USB_ROOT}/BACKUP/"; then
|
||||||
|
echo "Failed to backup original kernel"
|
||||||
|
rm -f "${USB_ROOT}/BACKUP/uImage"
|
||||||
|
error_exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Replace kernel
|
||||||
|
if ! cp -f "${USB_ROOT}/payload/uImage" /tmp/boot/uImage; then
|
||||||
|
echo "Failed to replace kernel"
|
||||||
|
if ! cp -f "${USB_ROOT}/BACKUP/uImage" /tmp/boot/uImage; then
|
||||||
|
echo "Failed to restore original kernel"
|
||||||
|
fi
|
||||||
|
error_exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Backup original mali.ko
|
||||||
|
if [ ! -f "${USB_ROOT}/BACKUP/mali.ko" ]; then
|
||||||
|
if ! cp /lib/modules/3.4.113/extra/mali.ko "${USB_ROOT}/BACKUP/"; then
|
||||||
|
echo "Failed to backup original mali.ko"
|
||||||
|
rm -f "${USB_ROOT}/BACKUP/mali.ko"
|
||||||
|
error_exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Replace mali.ko
|
||||||
|
if ! cp -f "${USB_ROOT}/payload/mali.ko" /lib/modules/3.4.113/extra/mali.ko; then
|
||||||
|
echo "Failed to replace mali.ko"
|
||||||
|
if ! cp -f "${USB_ROOT}/BACKUP/mali.ko" /lib/modules/3.4.113/extra/mali.ko; then
|
||||||
|
echo "Failed to restore original mali.ko"
|
||||||
|
fi
|
||||||
|
error_exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod 644 /lib/modules/3.4.113/extra/mali.ko
|
||||||
|
|
||||||
|
# Remove old files by GMMan
|
||||||
|
rm /usr/lib/libevdev.so.2
|
||||||
|
rm /usr/bin/input_relay
|
||||||
|
|
||||||
|
# Install files
|
||||||
|
if ! cp -f "${USB_ROOT}/payload/S40usbotg" /etc/init.d; then
|
||||||
|
echo "Failed to install init script"
|
||||||
|
error_exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod 755 /etc/init.d/S40usbotg
|
||||||
|
|
||||||
|
if ! cp -f "${USB_ROOT}/payload/ddgo-pnp-controller" /usr/bin; then
|
||||||
|
echo "Failed to install ddgo-pnp-controller"
|
||||||
|
error_exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod 755 /usr/bin/ddgo-pnp-controller
|
||||||
|
|
||||||
|
echo "Installation complete"
|
||||||
|
|
||||||
|
# We're done
|
||||||
|
poweroff
|
||||||
|
|
||||||
|
} > "${USB_ROOT}/log.txt" 2>&1
|
36
dist/payload/S40usbotg
vendored
Normal file
36
dist/payload/S40usbotg
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
start() {
|
||||||
|
ddgo-pnp-controller
|
||||||
|
echo 0ae4 > "/sys/class/android_usb/android0/idVendor"
|
||||||
|
echo 0003 > "/sys/class/android_usb/android0/idProduct"
|
||||||
|
echo -n "TAITO" > "/sys/class/android_usb/android0/iManufacturer"
|
||||||
|
echo -n "Densha de Go! Plug & Play" > "/sys/class/android_usb/android0/iProduct"
|
||||||
|
echo "rndis" > "/sys/class/android_usb/android0/functions"
|
||||||
|
echo 1 > "/sys/class/android_usb/android0/f_rndis/wceis"
|
||||||
|
echo 1 > "/sys/class/android_usb/android0/enable"
|
||||||
|
sleep 1
|
||||||
|
ifconfig rndis0 169.254.215.100 netmask 255.255.0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
killall -q ddgo-pnp-controller
|
||||||
|
echo 0 >"/sys/class/android_usb/android0/enable"
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$0: Please use start, stop, or restart."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
BIN
dist/payload/mali.ko
vendored
Normal file
BIN
dist/payload/mali.ko
vendored
Normal file
Binary file not shown.
BIN
dist/payload/uImage
vendored
Normal file
BIN
dist/payload/uImage
vendored
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue