Commit a48f640a authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz
Browse files

USB gadget: Drop g_multi in favor of gadgetfs

parent 78ec0086
Pipeline #68585 passed with stages
in 12 minutes and 38 seconds
......@@ -21,8 +21,11 @@ case "$1" in
configure)
# Enable serial console over USB
systemctl enable serial-getty@ttyGS0
# Mass storage is required for Ethernet+serial over USB via g_multi
truncate -s 1M /var/lib/mass_storage_dummy
# Mass storage is no longer required for Ethernet+serial over USB via g_multi
if md5sum /var/lib/mass_storage_dummy | grep -qs '^b6d81b360a5672d80c27430f39153e2c '; then
rm /var/lib/mass_storage_dummy
fi
if [ -z "$2" ]; then
echo "Initial install, linking shipment script"
......
[Unit]
Description=Manage USB gadget
# This line to make sure that services like sshd
# drop connections before the network goes down
PartOf=network.target
[Service]
Type=oneshot
ExecStart=/usr/share/librem5/usb_gadget_start
RemainAfterExit=true
ExecStop=/usr/share/librem5/usb_gadget_stop
StandardOutput=journal
StandardError=journal
# Environment="HOST_ADDR=00:11:22:33:44:55" # the MAC address on the host end
# The MAC address on the device end. Specify this to get stable DHCP assignments.
# Environment="DEV_ADDR=66:77:88:99:aa:bb"
[Install]
WantedBy=multi-user.target
......@@ -10,6 +10,7 @@ override_dh_installudev:
override_dh_installsystemd:
dh_installsystemd --no-start --name=resize_rootfs
dh_installsystemd --no-start --name=usb_gadget
override_dh_auto_test:
dh_auto_test
......
options g_multi file=/var/lib/mass_storage_dummy stall=0
# blacklist mainline driver (rsi):
blacklist rsi_91x
blacklist rsi_sdio
......
#!/bin/sh
set -xe
cd /sys/kernel/config/
cd usb_gadget
mkdir -p g1
cd g1
echo "0x316d" > idVendor
echo "0x4c05" > idProduct
echo "0xEF" > bDeviceClass
echo "0x02" > bDeviceSubClass
echo "0x01" > bDeviceProtocol
mkdir -p strings/0x409
echo "0123456789" > strings/0x409/serialnumber
echo "Purism, SPC" > strings/0x409/manufacturer
echo "Librem 5" > strings/0x409/product
mkdir -p functions/ecm.usb0
mkdir -p functions/acm.GS0
mkdir -p configs/c.1
mkdir -p configs/c.1/strings/0x409
echo "CDC ACM+ECM" > configs/c.1/strings/0x409/configuration
if [ -n "${HOST_ADDR}" ]; then
echo "${HOST_ADDR}" > functions/ecm.usb0/host_addr
fi
if [ -n "${DEV_ADDR}" ]; then
echo "${DEV_ADDR}" > functions/ecm.usb0/dev_addr
fi
ln -sf functions/acm.GS0 configs/c.1
ln -sf functions/ecm.usb0 configs/c.1
echo "38100000.usb" > UDC
#!/bin/sh
set -xe
cd /sys/kernel/config/
cd usb_gadget
cd g1
echo "" > UDC
rm configs/c.1/acm.GS0
rm configs/c.1/ecm.usb0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment