Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scripts to generate disk images using pi-gen. #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mrvelic
Copy link

@mrvelic mrvelic commented Nov 8, 2023

This is the fruit of something along the lines of "got too deep into it to back out now". I needed a newer raspios distro to use the pi I had setup for usb4vc for some alternate services on top of usb4vc.

Through reading the setup.txt notes in the user_program to setup my own image, I figured it might be good to use rpi foundations native image generation software to automatically bundle a disk image that contains usb4vc, and have it setup all the finicky system options / dependencies for you.

The pi_image_creation.md file contains most of the documentation of the build process of the image.
In total it represents a lot of trial and error ensuring the build process worked for both 32bit and 64bit raspios bullseye and bookworm base images.

In terms of changes to usb4vc itself, to support using environment variables to override where usb4vc thinks it is installed, I consolidated a lot of the paths into usb4vc_shared.py, built up by combining the optional env vars defaulted to /home/pi. I also wanted to test firmware updates / software updates in place against my own URLs so I added some options for those too.

In usb4vc_main, I added a function to check the kernel version, as it seems newer kernels do not require ertm disabled for xpadneo. xpadneo itself checks for 5.15+ but I was more conservative and went for 6+. The location of rpi_model.txt is migrated to inside the usb4vc folder, which should work for existing images (in /home/pi) and brand new ones (in /opt/usb4vc).

To support both usb automount methods, usb4vc_ui now checks for anything in /media which should cover /media/DRIVE_LABEL as well as /media/usb0-9 from usbmount. Also if it detects it's running in systemd (via env var), it will pipe the output from journalctl to the debug file on the USB mount, otherwise it falls back to copying the debug log.

In usb4vc_usb_scan, at the beginning of the loop it now does a struct calculation based on two void* ("PP") pointer sizes. In 32bit systems, this should return 8 (two 32bit (4 byte) timestamps), and for 64bit systems this should return 16 (two 64bit timestamps). Then an additional struct size calc for two ushorts and an unsigned int (event type, code, value). This allows the script to offset the timestamps correctly in both 32bit and 64bit systems.

Let me know your thoughts, I know this is a lot, and feel free to DM me on discord with any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant