Files
USB4VC/user_program/setup.txt

239 lines
4.5 KiB
Plaintext

-----------
Preparing SD card image for public release:
double check wpa_supplicant in /etc DOES NOT contain my own WiFi password
Put BLANK wpa_supplicant.conf in /boot
use the same base image for the same minor version, manually copy over the files, dont just dump the developement SD card.
-----------
Fresh install setup
raspbi-config
enable SPI, I2C, Serial (NO LOGIN SHELL)
sudo apt install git
set up ssh:
ssh-keygen
copy PC pub key to rpi ~/.ssh/authorized_keys
------------
IMPORTANT !!!!!!!!!!!!!!!!!!
sudo apt update
sudo apt upgrade
-------------
# use sudo -E to preserve environmental variables for python3
sudo apt-get update
sudo apt-get install i2c-tools
sudo apt install stm32flash
stm32flash -r PBFW_IBMPC_PBID1_V0_2_0.dfu -a 0x3b /dev/i2c-1
sudo apt install dfu-util
sudo dfu-util --device ,0483:df11 -a 0 -D ~/usb4vc/firmware/PBFW_ADB_PBID2_V0_1_1.dfu
-----
sudo apt install evtest
pip3 install evdev
sudo apt install python3-pip
raspberry pi 5 uses a different GPIO chip, this is a compatibility package
// no need
sudo apt remove python3-rpi.gpio
// no need?
sudo pip3 install --break-system-packages rpi-lgpio
cd ~;git clone https://github.com/atar-axis/xpadneo.git
sudo apt-get install dkms raspberrypi-kernel-headers
https://github.com/atar-axis/xpadneo
--------------
sudo mv /usr/lib/python3.11/EXTERNALLY-MANAGED /usr/lib/python3.11/EXTERNALLY-MANAGED.old
-----
Luma OLED driver
https://luma-oled.readthedocs.io/en/latest/software.html
sudo apt-get update
sudo apt-get install python3 python3-pip python3-pil libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libopenjp2-7 -y
sudo -H pip3 install luma.oled
-------------------
remove CTRL+ALT+DELETE reboot
sudo rm /lib/systemd/system/ctrl-alt-del.target
sudo ln -s /dev/null /lib/systemd/system/ctrl-alt-del.target
sudo systemctl daemon-reload
-------------------
run script on launch:
MAKE SURE SERIAL LOGIN SHELL IS TURNED OFF
https://raspberrypi-guide.github.io/programming/run-script-on-boot
sudo su
sudo nano /etc/rc.local
echo 1 > /sys/module/bluetooth/parameters/disable_ertm
cd /home/pi/usb4vc/rpi_app; python3 keep_alive.py 2>&1 | tee -a /home/pi/usb4vc/usb4vc_debug_log.txt &
kill -SIGINT pid
-----------
xbox one bluetooth driver
https://github.com/atar-axis/xpadneo
echo 'options bluetooth disable_ertm=Y' | sudo tee -a /etc/modprobe.d/bluetooth.conf
------------
boot speedup:
sudo nano /boot/firmware/config.txt
disable_splash=1
boot_delay=0
sudo nano /boot/firmware/cmdline.txt
Add quiet after rootwait
-------------
usb auto mount:
sudo apt install usbmount
sudo nano /lib/systemd/system/systemd-udevd.service
change to PrivateMounts=no
-----------
zero out free space to compress better:
cat /dev/zero > ./zero.file
wait until it exits
sync
rm zero.file
-----------
usb folder format:
usb root:
usb4vc_data
rpi_app
source code of raspberry pi application
firmware
dfu file for protocol boards
naming format: PBFW_IBMPC_PBID1_V0_1_0.dfu
config
config and mapping files
--------------
Raspberry Pi 5 Controller test:
WIRED
Xbox 360 wired: cant find the controller
Xbox One: OK
Xbox Series X: OK
PS4: ok
PS5: ok
Swich Pro: OK
BLUETOOTH
Xbox One: NO
Xbox Series X: NO
PS4: OK
PS5:
Swich Pro:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx NO LONGER NEEDED xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
raspberry pi 3
before speedup:
19.16
18.07
19.11
18.37
after speedup:
16.95
16.45
--------------
Nintendo Pro controller
https://retropie.org.uk/docs/Nintendo-Switch-Controllers/
sudo apt install git
sudo apt install dkms
sudo apt-get install libudev-dev
sudo apt-get install libevdev-dev
git clone https://github.com/nicman23/dkms-hid-nintendo
cd dkms-hid-nintendo
sudo dkms add .
sudo dkms build nintendo -v 3.2
sudo dkms install nintendo -v 3.2
git clone https://github.com/DanielOgorchock/joycond.git
cd joycond
cmake .
sudo make install
sudo systemctl enable --now joycond
----------------------
Serial setup:
serial clock is tied to GPU clock, need to fix it for it to be stable
sudo nano /boot/config.txt, add:
gpu_freq=250
gpu_freq_min=250
also, use /dev/serial0 to maintain compatibility for all models of pi
--------------
relaunch if exits:
while true; do echo think; sleep 1; done
---------
serial format:
U4 CMD_TYPE PAYLOAD
U4 header, any command not beginning with U4 is ignored
CMD TYPE:
SC: Shell Command, execute whatever follows in shell
RF: Read File
WF: Write File
GG: get gamepad file
QUIT: quit program
U4 RF /home/pi/usb4vc_data/config.json
U4 WF /home/pi/usb4vc_data/test.txt c3NoIHBpQDE5Mi4xNjguMS41Ng==