Bring up SSD2092 display/touch, USB NCM, HiDPI XLibre/DWM, and USB charging

This commit is contained in:
Luxferre committed 2026-11-22 15:49:38 +02:00
1 parent 034c1f61b1
commit 9db15e30ce
150 files changed
+2356 -446

No files matched your search

+33 -4
View File
@@ -21,13 +21,19 @@ start() {
for role_file in /sys/class/usb_role/*/role; do
[ -w "$role_file" ] || continue
if [ "$(cat "$role_file" 2>/dev/null || true)" = "none" ]; then
if [ "$(cat "$role_file" 2>/dev/null || true)" != "device" ]; then
echo "device" > "$role_file" 2>/dev/null || true
fi
done
udc_name="$(ls -1 /sys/class/udc 2>/dev/null | head -n1 || true)"
if [ -z "$udc_name" ]; then
i=0
while [ "$i" -lt 20 ]; do
udc_name="$(ls -1 /sys/class/udc 2>/dev/null | head -n1 || true)"
[ -n "$udc_name" ] && break
usleep 100000 2>/dev/null || sleep 1
i=$((i + 1))
done
if [ -z "${udc_name:-}" ]; then
ewarn "No UDC controller present; skipping usb0 gadget"
eend 0
return 0
@@ -52,7 +58,7 @@ start() {
fi
i=0
while [ "$i" -lt 10 ] && ! ip link show usb0 >/dev/null 2>&1; do
while [ "$i" -lt 20 ] && ! ip link show usb0 >/dev/null 2>&1; do
usleep 100000 2>/dev/null || sleep 1
i=$((i + 1))
done
@@ -60,12 +66,35 @@ start() {
if ip link show usb0 >/dev/null 2>&1; then
ip addr replace 172.16.42.1/24 dev usb0 2>/dev/null || true
ip link set usb0 up 2>/dev/null || true
if [ -x /usr/sbin/dnsmasq ]; then
if [ -r /run/geminux-usb-dnsmasq.pid ]; then
kill "$(cat /run/geminux-usb-dnsmasq.pid 2>/dev/null || true)" 2>/dev/null || true
rm -f /run/geminux-usb-dnsmasq.pid
fi
: > /run/geminux-usb-dnsmasq.leases
/usr/sbin/dnsmasq \
--port=0 \
--interface=usb0 \
--except-interface=lo \
--bind-dynamic \
--listen-address=172.16.42.1 \
--dhcp-range=172.16.42.2,172.16.42.20,255.255.255.0,1h \
--dhcp-option=3 \
--dhcp-option=6 \
--dhcp-leasefile=/run/geminux-usb-dnsmasq.leases \
--pid-file=/run/geminux-usb-dnsmasq.pid
fi
fi
eend 0
}
stop() {
ebegin "Stopping Geminux USB NCM gadget"
if [ -r /run/geminux-usb-dnsmasq.pid ]; then
kill "$(cat /run/geminux-usb-dnsmasq.pid 2>/dev/null || true)" 2>/dev/null || true
rm -f /run/geminux-usb-dnsmasq.pid
fi
if [ -w "$G/UDC" ]; then
echo "" > "$G/UDC" 2>/dev/null || true
fi