CustomerDisplay install

  • Download and burn raspbian lite : http://mirror.lagoon.nc/pub/downloads.raspberrypi.org/raspbian-lite/images/
  • Mount card on host pc. Will mount 2 partitions : boot and system
  • Create empty file named ssh on boot partition in root folder
  • Edit config.txt
    • Uncomment hdmi_force_hotplug=1
    • Append line dtoverlay=dwc2
  • On system partition, edit file /etc/modules
    • Append line dwc2
    • Append line libcomposite
  • On system partition, create file /usr/bin/isigadget
    • Make it executable chmod +x usr/bin/isigadget
    • Set content
#!/bin/bash -e
cd /sys/kernel/config/usb_gadget/
mkdir -p isigadget
cd isigadget

SERIAL="$(grep Serial /proc/cpuinfo | sed 's/Serial\s*: 0000\(\w*\)/\1/')"
MAC="$(echo ${SERIAL} | sed 's/\(\w\w\)/:\1/g' | cut -b 2-)"
MAC_HOST="12$(echo ${MAC} | cut -b 3-)"
MAC_DEV="02$(echo ${MAC} | cut -b 3-)"


echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
mkdir -p strings/0x409
echo "fedcba9876543210" > strings/0x409/serialnumber
echo "Isi.nc" > strings/0x409/manufacturer
echo "Isi.nc USB Device" > strings/0x409/product
mkdir -p configs/c.1/strings/0x409
echo "Config 1: ECM network" > configs/c.1/strings/0x409/configuration
echo 250 > configs/c.1/MaxPower
# Add functions here
mkdir -p functions/ecm.usb0
# first byte of address must be even
HOST="48:6f:73:74:50:43" # "HostPC"
SELF="42:61:64:55:53:42" # "BadUSB"
echo $HOST > functions/ecm.usb0/host_addr
echo $SELF > functions/ecm.usb0/dev_addr
ln -s functions/ecm.usb0 configs/c.1/
# see gadget configurations below
# End functions
ls /sys/class/udc > UDC

ifconfig usb0 10.0.0.1 netmask 255.255.255.252 up
route add -net default gw 10.0.0.2
  • On system partition, create file /usr/lib/systemd/system/isigadget.service
    • Set content
# /usr/lib/systemd/system/isigadget.service
 
[Unit]
Description=Isi.nc USB gadget
After=systemd-modules-load.service
 
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/isigadget
 
[Install]
WantedBy=sysinit.target
  • Eject memory card, install it in the pi, plug it (with the USB port, not the power port)
  • On host pc, if not already done, configure NAT, for the pi (test with ping from the pi)
  • Change default password : passwd
  • Update/upgrade sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove
  • Reboot
  • Configure locales, timezone, etc : sudo raspi-config
  • Upgrade firmware sudo rpi-upgrade
  • Reboot
  • Install required packages : sudo apt-get install dnsmasq
  • Configure DHCP server
    • sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
    • sudo nano /etc/dnsmasq.conf
      • Content
interface=usb0
  dhcp-range=10.0.0.2,10.0.0.2,255.255.255.252,1h