-
Notifications
You must be signed in to change notification settings - Fork 31
Set GPIO to control LED based on USB/device path #273
Description
I would like to use GPIOs on the Pi500 to indicate when a unit is being provisioned and when it's finished.
Since we want to be able to provision multiple units simultaneously I cannot hardcode the GPIOs that shall be used, I want individual LEDs for the different units currently being provisioned.
My idea is to use the USB path to determine which GPIO to control.
In the bootstrap script the USB path is available so that I can determine which GPIO to enable, the problem is that in the post-flash script the USB path is not available so I don't know which GPIO to disable.
I could solve this by saving the device serial number with the USB path to some temporary file in the bootstrap script, and then read the file in the post-flash script. But it's a bit hacky. Is it possible to add the USB path (or device path) as an argument to the post-flash script?
bootstrap
# Arguments:
# $1 - Target device serial number
# $2 - Target device family (e.g., 2712, 2711, 2710)
# $3 - Target USB path (e.g., 1-1.2)
# $4 - Target device path (e.g., /dev/bus/usb/001/004)
post-flash
# This script runs after images have been flashed to the device
# Arguments:
# $1 - Fastboot device specifier
# $2 - Target device serial number
# $3 - Device storage type (e.g., mmcblk0 or nvme0n1)
Related to #136