Compare commits

...

7 Commits

12 changed files with 243 additions and 23 deletions

View File

@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.32.0
# Tue Apr 6 08:18:28 2021
# Mon Aug 1 19:33:14 2022
#
CONFIG_HAVE_DOT_CONFIG=y

View File

@ -20,6 +20,7 @@ CONFIG_ARCH_SUNXI=y
CONFIG_SMP=y
CONFIG_HAVE_ARM_ARCH_TIMER=y
CONFIG_ARM_PSCI=y
CONFIG_HZ_200=y
CONFIG_HIGHMEM=y
CONFIG_CPU_FREQ=y
CONFIG_CPUFREQ_DT=y
@ -120,6 +121,9 @@ CONFIG_USB_ZERO=m
CONFIG_USB_ETH=m
CONFIG_USB_ETH_EEM=y
CONFIG_USB_G_NCM=m
CONFIG_USB_FUNCTIONFS=m
CONFIG_USB_FUNCTIONFS_ETH=y
CONFIG_USB_FUNCTIONFS_RNDIS=y
CONFIG_USB_MASS_STORAGE=m
CONFIG_USB_G_SERIAL=m
CONFIG_USB_G_ACM_MS=m

View File

@ -16,7 +16,7 @@
# Startup the system
::sysinit:/bin/cat /etc/issue
::sysinit:/bin/mount -t proc proc /proc
#::sysinit:/bin/mount -o remount,rw /
::sysinit:/bin/mount -o remount,rw /
::sysinit:/bin/mkdir -p /dev/pts /dev/shm
::sysinit:/bin/mount -a
::sysinit:/sbin/swapon -a

View File

@ -94,3 +94,8 @@ instant_play load
# Start frontend
echo "Start frontend"
frontend init >/dev/null 2>&1 &
# Debug
touch /mnt/adb
touch /mnt/disable_frontend
funkey_prod_screens TEARING 60 &

View File

@ -0,0 +1,154 @@
#!/bin/sh
#set -xv
SELF=${SELF:-$(basename $0)}
source /usr/local/lib/utils
source usb_gadget
# The composite gadget directory
GADGET=/sys/kernel/config/usb_gadget/FunKey
# USB VID for Intel
ID_VENDOR="0x8087"
# USB PID for Multifunction Composite Gadget
ID_PRODUCT="0x011e"
# Get the CPU serial number
SERIAL="$(grep Serial /proc/cpuinfo | sed 's/Serial\s*: \(\w*\)/\1/')"
# Initialize the ADB
init_adb() {
# Don't proceed if existing gadget is present
if [ -e ${GADGET} ]; then
return 0
fi
# Get the legacy drivers out of the way
modprobe -r g_ether
modprobe -r g_mass_storage
# Load the libcomposite USB driver, configfs and various other drivers
modprobe libcomposite
modprobe usb_f_serial
modprobe usb_f_fs
modprobe usb_f_acm
# USB Device Controller Driver
local udc_driver=$(ls /sys/class/udc | cut -f1 | head -n 1)
# Create our gadget directory
mkdir ${GADGET}
mkdir ${GADGET}/strings/0x409
mkdir ${GADGET}/configs/FunKey.1
mkdir ${GADGET}/configs/FunKey.1/strings/0x409
mkdir ${GADGET}/functions/acm.GS0
mkdir ${GADGET}/functions/ffs.adb
# USB VID and PID
echo ${ID_VENDOR} > ${GADGET}/idVendor
echo ${ID_PRODUCT} > ${GADGET}/idProduct
# Device String Descriptiors
echo "Intel" > ${GADGET}/strings/0x409/manufacturer
echo "FunKey S" > ${GADGET}/strings/0x409/product
echo ${SERIAL} > ${GADGET}/strings/0x409/serialnumber
# Configuration
# Maximum power is 120 mA
echo 120 > ${GADGET}/configs/FunKey.1/MaxPower
# Configuration String Descriptors
echo "ADB+CDC" > ${GADGET}/configs/FunKey.1/strings/0x409/configuration
# Add the ACM function to the FunKey.1 configuration
ln -s ${GADGET}/functions/acm.GS0 ${GADGET}/configs/FunKey.1
# Add the FunctionFS function to the FunKey.1 configuration
ln -s ${GADGET}/functions/ffs.adb ${GADGET}/configs/FunKey.1
# Create the function filesystem
mkdir /dev/usb-ffs
mkdir /dev/usb-ffs/adb
# Mount the ADB function filesystem
mount -t functionfs adb /dev/usb-ffs/adb
# Bring up the loopback network
ifup lo
# Launch the ADB daemon
adbd >/dev/null &
# Sleeping is required to wait for the UDC to come up
sleep 5
# Bind the USB Gadget
echo ${udc_driver} > ${GADGET}/UDC
return 0
}
# Deinitialize the ADB
deinit_adb() {
# Unbind the device
echo > ${GADGET}/UDC
# Kill the ADB daemon
killall adbd
# Bring down the local network
ifdown lo
# Unmount the ADB function filesystem
umount /dev/usb-ffs/adb
# Delete the function filesystem
rmdir /dev/usb-ffs/adb
rmdir /dev/usb-ffs
# Remove functions from configurations
rm ${GADGET}/configs/FunKey.1/acm.GS0
rm ${GADGET}/configs/FunKey.1/ffs.adb
# Remove string directories in configurations
rmdir ${GADGET}/configs/FunKey.1/strings/0x409
# Remove configurations
rmdir ${GADGET}/configs/FunKey.1
# Remove functions
rmdir ${GADGET}/functions/acm.GS0
rmdir ${GADGET}/functions/ffs.adb
# Remove strings
rmdir ${GADGET}/strings/0x409
# Finallyy remove the gadget
rmdir ${GADGET}
# Unload the kernel modules
modprobe -r usb_f_serial usb_f_fs usb_f_acm
}
case "$1" in
start)
deinit_usb_gadget
init_adb
;;
stop)
deinit_adb
init_usb_gadget
;;
*)
die 15 "Usage $0 {start|stop}"
;;
esac
exit $?

View File

@ -0,0 +1 @@
for i in /sys/class/graphics/fb0/freq_*; do echo $(basename $i): $(cat $i); done

View File

@ -37,25 +37,25 @@ trap toggle_perform SIGUSR1
while true; do
if [ ${perform} -eq 1 ]; then
# Compute stats
cpu=$(printf "%.0f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}'))
ram_mem=$(printf "%.0f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}'))
ram_swap=$(printf "%.0f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}'))
ip_addr=$(ifconfig usb0 | grep "inet " | awk -F'[: ]+' '{ print $4 }')
# Compute stats
cpu=$(printf "%.0f\n" $(mpstat -P ALL $UPDATE_PERIOD 1 | tail -1 | awk '{print 100-$12}'))
ram_mem=$(printf "%.0f\n" $(free | grep Mem | awk '{print $3/$2 * 100.0}'))
ram_swap=$(printf "%.0f\n" $(free | grep Swap | awk '{print $3/$2 * 100.0}'))
ip_addr=$(ifconfig usb0 | grep "inet " | awk -F'[: ]+' '{ print $4 }')
# Notif
if [ ${notif_dirty} -eq 1 ]; then
notif clear
notif_dirty=0
else
if [ "x${ip_addr}" != "x" ]; then
notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%^IP:${ip_addr}"
else
notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%"
fi
fi
# Notif
if [ ${notif_dirty} -eq 1 ]; then
notif clear
notif_dirty=0
else
if [ "x${ip_addr}" != "x" ]; then
notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%^IP:${ip_addr}"
else
notif set 0 " CPU:${cpu}%% RAM:${ram_mem}%% SWAP:${ram_swap}%%"
fi
fi
else
sleep ${UPDATE_PERIOD}
sleep ${UPDATE_PERIOD}
fi
done
exit 0

View File

@ -6,13 +6,17 @@ SELF=${SELF:-$(basename $0)}
source /usr/local/lib/utils
# The composite gadget directory
# The composite gadget directory
GADGET=/sys/kernel/config/usb_gadget/FunKey
# Check if Ethernet over USB network is requested
[ ! -f /mnt/usbnet ]
USBNET=${?}
# Check if Android Debug Bridge is requested
[ ! -f /mnt/adb ]
ADB=${?}
# USB VID for Linux Foundation
ID_VENDOR="0x1d6b"
@ -37,6 +41,12 @@ init_usb_gadget() {
return 0
fi
# ADB has precedence over USB Mass Storage / Ethernet over USB
if [ ${ADB} -eq 1 ]; then
adb start
return 0
fi
# Get the legacy drivers out of the way
modprobe -r g_ether
modprobe -r g_mass_storage
@ -167,3 +177,48 @@ init_usb_gadget() {
echo ${udc_driver} > ${GADGET}/UDC
return 0
}
# Deinitialize the USB gadget
deinit_usb_gadget() {
# Unbind the device
echo > ${GADGET}/UDC
# Remove functions from configurations
rm ${GADGET}/configs/FunKey.1/mass_storage.mmcblk0p4
if [ ${USBNET} -eq 1 ]; then
rm ${GADGET}/configs/FunKey.1/rndis.usb0
fi
# Remove string directories in configurations
rmdir ${GADGET}/configs/FunKey.1/strings/0x409
# Remove configurations from OS descriptors
if [ ${USBNET} -eq 1 ]; then
rm ${GADGET}/os_desc/FunKey.1
fi
# Remove configurations
rmdir ${GADGET}/configs/FunKey.1
# Remove extended properties from OS descriptors
if [ ${USBNET} -eq 1 ]; then
rmdir ${GADGET}/functions/rndis.usb0/os_desc/interface.rndis/Icons
rmdir ${GADGET}/functions/rndis.usb0/os_desc/interface.rndis/Label
fi
# Remove functions
rmdir ${GADGET}/functions/mass_storage.mmcblk0p4
if [ ${USBNET} -eq 1 ]; then
rmdir ${GADGET}/functions/rndis.usb0
fi
# Remove strings
rmdir ${GADGET}/strings/0x409
# Finallyy remove the gadget
rmdir ${GADGET}
# Unload the kernel modules
modprobe -r usb_f_mass_storage usb_f_rndis
}

View File

@ -14,7 +14,7 @@ BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
BR2_TARGET_OPTIMIZATION="-fno-PIC -march=armv7-a+neon-vfpv4 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -D__ARM_NEON__"
BR2_TARGET_OPTIMIZATION="-fno-PIC -mfloat-abi=hard -march=armv7-a+neon-vfpv4 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad"
BR2_TARGET_GENERIC_HOSTNAME="FunKey"
BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot for the FunKey"
BR2_ROOTFS_DEVICE_TABLE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/device_table.txt"

View File

@ -4,7 +4,8 @@
#
################################################################################
PRODSCREENS_VERSION = FunKey-ProdScreens-FunKey-1.1.2
#PRODSCREENS_VERSION = FunKey-ProdScreens-FunKey-1.1.2
PRODSCREENS_VERSION = ab76d63f46b531871daad4d86059d333ceb80276
PRODSCREENS_SITE_METHOD = git
PRODSCREENS_SITE = https://github.com/FunKey-Project/FunKey-ProdScreens.git
PRODSCREENS_SITE_LICENSE = GPL-2.1+

View File

@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Busybox version: 1.32.0
# Tue Apr 6 07:55:56 2021
# Mon Aug 1 19:17:50 2022
#
CONFIG_HAVE_DOT_CONFIG=y