BigW Consortium Gitlab

Commit 59d63da5 by Shikai Chen

added arm_suite target side utility to help install the usbdisp driver

parent 91eb0289
# Introduction #
RoboPeak USB Display Linux Driver Arm Suite is used to enable RoboPeak USB Display on ubuntu for arm (linaro) on arm SoCs.
# Install #
Use scp to copy `arm_suite.tar.bz2` to the host:
$ scp arm_suite.tar.bz2 ubuntu@your_mini_pc/arm_suite.tar.bz2
And than connect to your host via ssh to install the driver:
$ ssh -l ubuntu your_mini_pc
$ tar xf arm_suite.tar.bz2
$ cd arm_suite
$ sudo ./rpusbdisp_arm_tool.sh install
$ sudo ./rpusbdisp_arm_tool.sh auto_load
This will install prebuilt driver to the mini pc, as well as `lightdm` configuration and `upstart` configuration
# Usage #
Just reboot your mini pc by:
$ sudo reboot
The driver will be loaded automatically on system startup
When you plug in your RoboPeak USB Display, the driver daemon will automatically configure `lightdm`, and restart it. This will also happen when you unplug your device.
* NOTE: Every time you plug in or pull out your RoboPeak USB Display, the driver daemon will restart `lightdm`, so your current GUI login session will be dropped *
# Homebrew #
If there is no prebuilt driver available for your device/kernel combination, you may build the kernel driver on your own, for detailed information please refer to our repository hosted on GitHub:
<https://github.com/robopeak/rpusbdisp>
# Copyright & Contact #
Copyright (c) 2013 RoboPeak.com
If you have any question or advice, please make us know. We will be very thankful if you contact us:
<mailto:support@robopeak.com>
Section "Device"
Identifier "RPUSBDispFB"
Driver "fbdev"
Option "fbdev" "/dev/fb0"
EndSection
Section "Screen"
Identifier "RPUSBDisp"
Device "RPUSBDispFB"
DefaultFbBpp 16
SubSection "Display"
Visual "TrueColor"
EndSubSection
EndSection
Section "InputClass"
Identifier "RPUSBTouch"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
EndSection
# rpusbdisp - RoboPeak USB Display daemon
#
# The daemon process of RoboPeak USB Display.
description "Rp USB Display"
start on filesystem or runlevel [!06]
stop on runlevel [016]
respawn
respawn limit 10 5
umask 022
# 'sshd -D' leaks stderr and confuses things in conjunction with 'console log'
console none
# if you used to set SSHD_OPTS in /etc/default/ssh, you can change the
# 'exec' line here instead
exec /etc/init.d/rpusbdispd start
#! /bin/bash
function install_kernel_module {
echo "Installing kernel module..."
echo "Please enter your board type (pcduino, cubieboard, cubieboard2...):"
read
BOARD_TYPE=$REPLY
KERNEL_VERSION=$(uname -r)
MODULE_PATH=kernel_modules/${BOARD_TYPE}/${KERNEL_VERSION}/rp_usbdisplay.ko
if [ ! -f $MODULE_PATH ]; then
echo "No suitable kernel module found for board '$BOARD_TYPE' and kernel version '$KERNEL_VERSION'"
echo "Please contact support@robopeak.com to request your combination or compile it by yourself"
exit 1
fi
INSTALL_PATH=/lib/modules/${KERNEL_VERSION}/kernel/rp_usbdisplay.ko
if [ -e $INSTALL_PATH ]; then
echo "File '$INSTALL_PATH' already exist, override it?"
read
if [ "$REPLY" != "yes" ]; then
exit 1;
fi
fi
echo "Installing"
echo " From: $MODULE_PATH"
echo " To: $INSTALL_PATH"
install "$MODULE_PATH" "$INSTALL_PATH" || exit 1
if [ ! -e $INSTALL_PATH ]; then
echo "Failed to install kernel module"
exit 1;
fi
depmod -a || exit 1
}
function auto_load {
echo "Setting up rpusbdisp daemon..."
mkdir -p /etc/rpusbdisp || exit 1
cp scripts/rpusbdispd.sh /etc/rpusbdisp || exit 1
cp scripts/rpusbdispd /etc/init.d || exit 1
cp conf/10-disp.conf /etc/rpusbdisp || exit 1
cp conf/rpusbdisp.conf /etc/init || exit 1
initctl reload-configuration || exit 1
echo "Done"
}
case "$1" in
install_kernel_module)
install_kernel_module
;;
auto_load)
auto_load
;;
*)
echo "Unknown command '$1'"
echo "Supported commands:"
echo " install_kernel_module"
echo " auto_load"
exit 1
;;
esac
#! /bin/sh -e
# upstart-job
case "$1" in
start)
/etc/rpusbdisp/rpusbdispd.sh start &
;;
stop)
/etc/rpusbdisp/rpusbdispd.sh stop &
;;
restart)
start
stop
;;
esac
#! /bin/bash
CONF_FILE_SOURCE=/etc/rpusbdisp/10-disp.conf
CONF_FILE_TARGET=/usr/share/X11/xorg.conf.d/10-disp.conf
function ensure_conf_exist {
if [ ! -f "$CONF_FILE_TARGET" ]; then
echo "Config doesn't exist creating one..."
/etc/init.d/lightdm stop
cp "$CONF_FILE_SOURCE" "$CONF_FILE_TARGET"
fi
}
function ensure_conf_not_exist {
if [ -f "$CONF_FILE_TARGET" ]; then
echo "Removing disp conf..."
/etc/init.d/lightdm stop
rm -f "$CONF_FILE_TARGET"
fi
}
function ensure_fb_id {
RP_USB_DISP_FB_ID=$1
HAS_CORRECT_FB_ID=$(cat $CONF_FILE_TARGET | grep /dev/fb${RP_USB_DISP_FB_ID})
if [ "$HAS_CORRECT_FB_ID" == "" ]; then
echo "fb id error, correcting fb id to $RP_USB_DISP_FB_ID..."
/etc/init.d/lightdm stop
cat "$CONF_FILE_SOURCE" | sed -E "s/\/dev\/fb[0-9]+/\/dev\/fb${RP_USB_DISP_FB_ID}/g" > "$CONF_FILE_TARGET"
fi
}
function ensure_lightdm_running {
LIGHT_DM_RUNNING=$(ps -A | grep lightdm | tail -n 1)
if [ "${LIGHT_DM_RUNNING}" == "" ]; then
echo "lightdm stopped, starting..."
/etc/init.d/lightdm start
fi
}
function daemon {
while [ -e /tmp/rpusbdispd.run ]; do
RP_USB_DISP_FB_ID=$(cat /proc/fb | grep rp | sed -E 's/^([0-9]+)\s.*$/\1/')
STATUS=$(dmesg | grep "RP USB Display" | tail -n 1 | grep "found")
if [ "$STATUS" != "" ]; then
echo "Rp usb display detected: $RP_USB_DISP_FB_ID"
ensure_conf_exist
ensure_fb_id $RP_USB_DISP_FB_ID
else
echo "No rp usb display detected"
ensure_conf_not_exist
fi
ensure_lightdm_running
sleep 1
done
}
function start {
if [ -e /tmp/rpusbdispd.run ]; then
echo "rpusbdispd already running"
exit 1
fi
KERNEL_MODULE_LOADED=$(lsmod | grep rp_usbdisplay)
if [ "$KERNEL_MODULE_LOADED" == "" ]; then
modprobe -f rp_usbdisplay
fi
touch /tmp/rpusbdispd.run
daemon
}
function stop {
if [ ! -e /tmp/rpusbdispd.run ]; then
echo "rpusbdispd is not running"
exit 1
fi
rm -rf /tmp/rpusbdispd.run
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo "rpusbdispd.sh [start|stop]"
exit 1
;;
esac
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