streampunk
2018-01-23 18:38:06 UTC
Thanks so much for the tutorial. This is the kind of stuff I'd say that
I wouldn't have achieved by myself in a 1000 years...
An addition which might be helpful to all that use USB devices with the
Raspi (there are several posts pointing out that plugging in a mouse or
a keyboard during the setup process causes some confusion with the event
numbers).
The original do_rebootstuff.sh had some lines that dynamically detect
the event number and that are commented out in the tutorial which
hardcodes "event0" instead of "$eventno":
Code:
--------------------
if [ "$JIVELITE" = "yes" ]; then
echo -n "${BLUE}Starting Jivelite... ${NORMAL}"
# eventno=$( cat /proc/bus/input/devices | awk '/*FT5406 memory based driver*/{for(a=0;a>=0;a++){getline;{if(/mouse/==1){ print $NF;exit 0;}}}}')
# if [ x"" != x"$eventno" ];then
# export JIVE_NOCURSOR=1
export TSLIB_TSDEVICE=/dev/input/*event0*
export SDL_MOUSEDRV=TSLIB
export SDL_MOUSEDEV=$TSLIB_TSDEVICE
# fi
--------------------
This is because the search pattern "FT5406" only applies to certain
hardware componenents. But if you know the "name" of your 3.5
touchscreen, you can easily adapt the dynamic event number logic.
You get the name by typing
Code:
--------------------
cat /proc/bus/input/devices
--------------------
at the prompt (via Putty). In my case for example (a 20 Euro display
from Amazon) it reads (no USB device plugged in):
Code:
--------------------
***@piCorePlayer:~$ cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="*ADS7846 Touchscreen*"
P: Phys=spi0.1/input0
S: Sysfs=/devices/platform/soc/3f204000.spi/spi_master/spi0/spi0.1/input/input0
U: Uniq=
H: Handlers=mouse0 event0
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=1000003
--------------------
So if I put the name "ADS7846 Touchscreen" into do_rebootstuff.sh,
everything works perfectly, no matter what USB devices are plugged in.
This is the code (which also includes ralphy's patch from post #64:
Code:
--------------------
if [ "$JIVELITE" = "yes" ]; then
echo -n "${BLUE}Starting Jivelite... ${NORMAL}"
eventno=$( cat /proc/bus/input/devices | awk '/*ADS7846 Touchscreen*/{for(a=0;a>=0;a++){getline;{if(/mouse/==1){ print $NF;exit 0;}}}}')
if [ x"" != x"$eventno" ];then
export JIVE_NOCURSOR=1
export TSLIB_TSDEVICE=/dev/input/*$eventno*
export SDL_MOUSEDRV=TSLIB
export SDL_MOUSEDEV=$TSLIB_TSDEVICE
fi
export HOME=/home/tc
# if [ -x /opt/jivelite/bin/jivelite.sh ]; then
if [ -x /mnt/mmcblk0p2/tce/jivelite.sh ]; then
echo "${GREEN}Done.${NORMAL}"
sudo -E -b /mnt/mmcblk0p2/tce/jivelite.sh >/dev/null 2>&1
elif [ -x /opt/jivelite/bin/jivelite.sh ]; then
echo "${GREEN}Done.${NORMAL}"
sudo -E -b /opt/jivelite/bin/jivelite.sh >/dev/null 2>&1
else
echo "${RED}There is a problem with the Jivelite installation. Please remove and reinstall jivelite.${NORMAL}"
fi
fi
--------------------
Best regards
Martin
PCP (always latest version) on RasPi 3 with PhatDac (player & server)
PCP on several RasPis 2 +3
2 Airplay speakers (Sony SA-NS510) integrated via Airplay Bridge Plugin
------------------------------------------------------------------------
streampunk's Profile: http://forums.slimdevices.com/member.php?userid=66210
View this thread: http://forums.slimdevices.com/showthread.php?t=107366
I wouldn't have achieved by myself in a 1000 years...
An addition which might be helpful to all that use USB devices with the
Raspi (there are several posts pointing out that plugging in a mouse or
a keyboard during the setup process causes some confusion with the event
numbers).
The original do_rebootstuff.sh had some lines that dynamically detect
the event number and that are commented out in the tutorial which
hardcodes "event0" instead of "$eventno":
Code:
--------------------
if [ "$JIVELITE" = "yes" ]; then
echo -n "${BLUE}Starting Jivelite... ${NORMAL}"
# eventno=$( cat /proc/bus/input/devices | awk '/*FT5406 memory based driver*/{for(a=0;a>=0;a++){getline;{if(/mouse/==1){ print $NF;exit 0;}}}}')
# if [ x"" != x"$eventno" ];then
# export JIVE_NOCURSOR=1
export TSLIB_TSDEVICE=/dev/input/*event0*
export SDL_MOUSEDRV=TSLIB
export SDL_MOUSEDEV=$TSLIB_TSDEVICE
# fi
--------------------
This is because the search pattern "FT5406" only applies to certain
hardware componenents. But if you know the "name" of your 3.5
touchscreen, you can easily adapt the dynamic event number logic.
You get the name by typing
Code:
--------------------
cat /proc/bus/input/devices
--------------------
at the prompt (via Putty). In my case for example (a 20 Euro display
from Amazon) it reads (no USB device plugged in):
Code:
--------------------
***@piCorePlayer:~$ cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="*ADS7846 Touchscreen*"
P: Phys=spi0.1/input0
S: Sysfs=/devices/platform/soc/3f204000.spi/spi_master/spi0/spi0.1/input/input0
U: Uniq=
H: Handlers=mouse0 event0
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=1000003
--------------------
So if I put the name "ADS7846 Touchscreen" into do_rebootstuff.sh,
everything works perfectly, no matter what USB devices are plugged in.
This is the code (which also includes ralphy's patch from post #64:
Code:
--------------------
if [ "$JIVELITE" = "yes" ]; then
echo -n "${BLUE}Starting Jivelite... ${NORMAL}"
eventno=$( cat /proc/bus/input/devices | awk '/*ADS7846 Touchscreen*/{for(a=0;a>=0;a++){getline;{if(/mouse/==1){ print $NF;exit 0;}}}}')
if [ x"" != x"$eventno" ];then
export JIVE_NOCURSOR=1
export TSLIB_TSDEVICE=/dev/input/*$eventno*
export SDL_MOUSEDRV=TSLIB
export SDL_MOUSEDEV=$TSLIB_TSDEVICE
fi
export HOME=/home/tc
# if [ -x /opt/jivelite/bin/jivelite.sh ]; then
if [ -x /mnt/mmcblk0p2/tce/jivelite.sh ]; then
echo "${GREEN}Done.${NORMAL}"
sudo -E -b /mnt/mmcblk0p2/tce/jivelite.sh >/dev/null 2>&1
elif [ -x /opt/jivelite/bin/jivelite.sh ]; then
echo "${GREEN}Done.${NORMAL}"
sudo -E -b /opt/jivelite/bin/jivelite.sh >/dev/null 2>&1
else
echo "${RED}There is a problem with the Jivelite installation. Please remove and reinstall jivelite.${NORMAL}"
fi
fi
--------------------
Best regards
Martin
PCP (always latest version) on RasPi 3 with PhatDac (player & server)
PCP on several RasPis 2 +3
2 Airplay speakers (Sony SA-NS510) integrated via Airplay Bridge Plugin
------------------------------------------------------------------------
streampunk's Profile: http://forums.slimdevices.com/member.php?userid=66210
View this thread: http://forums.slimdevices.com/showthread.php?t=107366