Commit 032ae6c1 authored by aTc's avatar aTc

updated letux scripts

parent a9ea0e89
......@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
{
if(debug)
fprintf(stderr, "aux=%d", aux);
if(aux > 2048) // max ambient light
ambient_light = 0;
else if(aux > 1024)
......@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
ambient_light = 3;
else // min ambient light
ambient_light = 4;
bl = 1+((MAX_BL-1)*ambient_light)/4;
if(debug)
fprintf(stderr, " ->");
......
#
# start camera demo
#
if [ ! "$DISPLAY" ]
then
. /root/x # set DISPLAY
fi
. /root/x # set DISPLAY
. /root/camera-setup # load setup script
PATH=$PATH:/usr/bin/arm-linux-gnueabihf
......
......@@ -20,7 +20,7 @@
[ "$(which media-ctl)" ] || apt-get install -y v4l-utils
CAM=ov965x # driver name not camera model! use media-ctl -p to find out
CAM="ov9655 1-0030" # driver name not camera model! use media-ctl -p to find out
CAMERA='"'$CAM'"' # sometimes we need quotes in the variable value
CPATH="$(media-ctl -e "$CAM")"
......@@ -47,88 +47,91 @@ function media-format { # $1 = entity, $2 = format $3 = widthxheight
media-ctl -V "$1 [$2 $3]"
}
function setup { # $1 = video mode
function setup { # -r: choose resizer; $1 = video resolution
echo "Setting mode $1"
echo Setting mode "$@"
media-reset
RESIZER=false # bypassing OMAP ISP (almost)
while [ "$1" ]
do
case "$1" in
-r )
RESIZER=true
shift
;;
* ) break;;
esac
done
case "$1" in
sxga ) # bypassing OMAP ISP (almost)
media-link "$CAMERA:0" '"OMAP3 ISP CCDC":0[1]'
media-link '"OMAP3 ISP CCDC":1' '"OMAP3 ISP CCDC output":0[1]'
media-format "$CAMERA:0" UYVY2X8 1280x1024
media-format '"OMAP3 ISP CCDC":0' UYVY2X8 1280x1024
media-format '"OMAP3 ISP CCDC":1' UYVY 1280x1024
DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
sxga )
FORMAT=uyvy
CCDCFORMAT=UYVY2X8
WIDTH=1280
HEIGHT=1024
FPS=15
;;
vga ) # try bypassing OMAP ISP by programming the camera to VGA mode (is not completely supported by kernel driver!)
media-link "$CAMERA:0" '"OMAP3 ISP CCDC":0[1]'
media-link '"OMAP3 ISP CCDC":1' '"OMAP3 ISP CCDC output":0[1]'
media-format "$CAMERA:0" UYVY2X8 640x480
media-format '"OMAP3 ISP CCDC":0' UYVY2X8 640x480
media-format '"OMAP3 ISP CCDC":1' UYVY 640x480
DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
vga )
FORMAT=uyvy
CCDCFORMAT=UYVY2X8
WIDTH=640
HEIGHT=480
FPS=30
;;
vga-resizer | vga-r* )
media-link "$CAMERA:0" '"OMAP3 ISP CCDC":0[1]'
media-link '"OMAP3 ISP CCDC":1' '"OMAP3 ISP resizer":0[1]'
media-link '"OMAP3 ISP resizer":1' '"OMAP3 ISP resizer output":0[1]'
media-format "$CAMERA:0" UYVY2X8 1280x1024
media-format '"OMAP3 ISP CCDC":1' UYVY 1280x1024
media-format '"OMAP3 ISP resizer":1' UYVY 1280x1024
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
qvga )
FORMAT=uyvy
WIDTH=640
HEIGHT=480
CCDCFORMAT=UYVY2X8
WIDTH=320
HEIGHT=240
FPS=30
;;
# old code
sxga-old )
media-link "$CAMERA:0" '"OMAP3 ISP CCDC":0[1]'
media-link '"OMAP3 ISP CCDC":2' '"OMAP3 ISP preview":0[1]'
media-link '"OMAP3 ISP preview":1' '"OMAP3 ISP resizer":0[1]'
media-link '"OMAP3 ISP resizer":1' '"OMAP3 ISP resizer output":0[1]'
media-format "$CAMERA:0" SGRBG10 1280x1024
media-format '"OMAP3 ISP CCDC":2' SGRBG10 1280x1024
media-format '"OMAP3 ISP preview":1' UYVY 1280x1024
media-format '"OMAP3 ISP resizer":1' UYVY 1280x1024
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
qqvga )
FORMAT=uyvy
WIDTH=1280
HEIGHT=1024
FPS=15
;;
# old code not converted
qvga-old )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 320x240], "OMAP3 ISP CCDC":2 [SGRBG10 320x240], "OMAP3 ISP preview":1 [UYVY 320x240], "OMAP3 ISP resizer":1 [UYVY 320x240]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=320:height=240:fps=30 -vo x11
CCDCFORMAT=UYVY2X8
WIDTH=160
HEIGHT=120
FPS=30
;;
cif-old )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 352x288], "OMAP3 ISP CCDC":2 [SGRBG10 352x288], "OMAP3 ISP preview":1 [UYVY 352x288], "OMAP3 ISP resizer":1 [UYVY 352x288]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=352:height=288:fps=30 -vo x11
cif )
FORMAT=uyvy
CCDCFORMAT=UYVY2X8
WIDTH=352
HEIGHT=288
FPS=30
;;
vga-old )
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 640x480], "OMAP3 ISP CCDC":2 [SGRBG10 640x480], "OMAP3 ISP preview":1 [UYVY 640x480], "OMAP3 ISP resizer":1 [UYVY 640x480]'
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
mplayer tv:// -vf rotate=2 -tv driver=v4l2:device=$DEVICE:outfmt=uyvy:width=640:height=480:fps=30 -vo x11
qcif )
FORMAT=uyvy
CCDCFORMAT=UYVY2X8
WIDTH=176
HEIGHT=144
FPS=30
;;
* )
echo Unknown camera mode $1
echo Unknown camera resolution $1
echo valid modes: [-r] sxga vga qvga qqvga cif qcif
exit 1
;;
esac
media-link "$CAMERA:0" '"OMAP3 ISP CCDC":0[1]'
media-format "$CAMERA:0" $CCDCFORMAT ${WIDTH}x${HEIGHT}
media-format '"OMAP3 ISP CCDC":0' $CCDCFORMAT ${WIDTH}x${HEIGHT}
media-format '"OMAP3 ISP CCDC":1' $CCDCFORMAT ${WIDTH}x${HEIGHT}
if $RESIZER
then
media-link '"OMAP3 ISP CCDC":1' '"OMAP3 ISP resizer":0[1]'
media-link '"OMAP3 ISP resizer":1' '"OMAP3 ISP resizer output":0[1]'
media-format '"OMAP3 ISP resizer":1' UYVY ${WIDTH}x${HEIGHT}
DEVICE=$(media-ctl -e "OMAP3 ISP resizer output")
else
media-link '"OMAP3 ISP CCDC":1' '"OMAP3 ISP CCDC output":0[1]'
DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
fi
echo "Device: $DEVICE"
}
......@@ -3,31 +3,15 @@
# see also http://projects.goldelico.com/p/gta04-kernel/page/Camera/
#
PATH=$PATH:/usr/bin/arm-linux-gnueabihf
make capture
[ "$(which media-ctl)" ] || apt-get install -y v4l-utils
CAMERA="ov9650" # driver name not camera model! use media-ctl -p to find out
. /root/camera-setup # load setup script
CPATH="$(media-ctl -e "$CAMERA")"
if [ ! -r "$CPATH" ]
then
echo "Camera $CAMERA not found!"
exit
fi
echo Camera: $CPATH
PATH=$PATH:/usr/bin/arm-linux-gnueabihf
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [SGRBG10 1280x1024], "OMAP3 ISP CCDC":2 [SGRBG10 1280x1024], "OMAP3 ISP preview":1 [UYVY 1280x1024], "OMAP3 ISP resizer":1 [UYVY 1024x768]'
media-ctl -r -l '"'"$CAMERA"'":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -V '"'"$CAMERA"'":0 [UYVY2X8 1280x1024]'
# media-ctl -V '"OMAP3 ISP CCDC":0 [UYVY2X8 1280x1024]' # is set automatically
media-ctl -V '"OMAP3 ISP CCDC":1 [UYVY 1280x1024]'
MODE=$1; [ "$MODE" ] || MODE=sxga
DEVICE=$(media-ctl -e "OMAP3 ISP CCDC output")
setup "$MODE"
echo "### capturing $CAMERA at $DEVICE ###"
make capture
./capture -d $DEVICE # -o snapshot.jpg
......@@ -207,7 +207,7 @@ mainloop (void)
if (read_frame ())
break;
/* EAGAIN - continue select loop. */
}
}
......@@ -258,7 +258,7 @@ start_capturing (void)
if (-1 == xioctl (fd, VIDIOC_QBUF, &buf))
errno_exit ("VIDIOC_QBUF");
}
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (-1 == xioctl (fd, VIDIOC_STREAMON, &type))
......@@ -506,7 +506,7 @@ init_device (void)
break;
}
}
} else {
} else {
/* Errors ignored. */
}
......@@ -515,11 +515,11 @@ init_device (void)
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
// get this from command line options!
fmt.fmt.pix.width = 1280;
fmt.fmt.pix.width = 1280;
fmt.fmt.pix.height = 1024;
// fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
//fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
if (-1 == xioctl (fd, VIDIOC_S_FMT, &fmt))
errno_exit ("VIDIOC_S_FMT");
......@@ -561,7 +561,7 @@ close_device (void)
static void
open_device (void)
{
struct stat st;
struct stat st;
if (-1 == stat (dev_name, &st)) {
fprintf (stderr, "Cannot identify '%s': %d, %s\n",
......@@ -621,7 +621,7 @@ main (int argc,
for (;;) {
int index;
int c;
c = getopt_long (argc, argv,
short_options, long_options,
&index);
......
......@@ -52,7 +52,7 @@ function turnoff {
amixer set 'Earpiece Mixer Voice' off
amixer set 'HeadsetL Mixer Voice' off
amixer set 'HeadsetR Mixer Voice' off
(echo "AT+CHUP"; sleep 1) | ./femtocom $IF
(echo "AT+CHUP"; sleep 1) | /root/femtocom $IF
}
trap "turnoff" EXIT
trap "exit 1" SIGHUP SIGINT SIGTERM
......@@ -145,7 +145,7 @@ function turnoff {
# sleep 99999 # we can't easily detect end of call (without monitoring femtocom output)
fi
fi
) | ./femtocom $IF
) | /root/femtocom $IF
;;
/dev/ttyACM[0-4] | /dev/ttyUSB[0-4] ) # Neo900 / Pyra
......@@ -174,8 +174,6 @@ function turnoff {
sleep 99999
fi
fi
) | ./femtocom $IF
esac
) | /root/femtocom $IF
esac
#!/bin/bash
for i in /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/mmcblk0 /dev/mmcblk1 /dev/mmcblk2 /dev/mmcblk3 /dev/nand
do
if [ -b "$i" ]
then
echo "+++ checking $i +++"
hdparm -tT --direct "$i"
# could also use dd, see: https://wiki.ubuntuusers.de/Festplatten-Geschwindigkeitstest/
fi
done
......@@ -53,7 +53,14 @@ int main(int argc, char *argv[])
// Start reading
png_init_io(png_ptr, fp);
png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_STRIP_ALPHA | PNG_TRANSFORM_PACKING, NULL);
png_read_png(png_ptr, info_ptr,
PNG_TRANSFORM_STRIP_16 |
PNG_TRANSFORM_STRIP_ALPHA |
PNG_TRANSFORM_PACKING |
PNG_TRANSFORM_GRAY_TO_RGB |
PNG_TRANSFORM_EXPAND,
NULL);
row_ptr = png_get_rows(png_ptr, info_ptr);
if (row_ptr == NULL)
{
......@@ -75,21 +82,22 @@ int main(int argc, char *argv[])
if (ret == -1)
perror("ioctl(FBIOGET_VSCREENINFO)");
if ((fbvar.bits_per_pixel != 32) && (fbvar.bits_per_pixel != 24)) {
fbvar.bits_per_pixel = info_ptr->pixel_depth;
ret = ioctl(fd, FBIOPUT_VSCREENINFO, &fbvar);
if (ret == -1)
perror("ioctl(FBIOPUT_VSCREENINFO)");
}
destsize = fbvar.xres_virtual * fbvar.yres_virtual
* info_ptr->pixel_depth / 8;
* fbvar.bits_per_pixel / 8;
dest = mmap(0, destsize, PROT_WRITE|PROT_READ, MAP_SHARED, fd, 0);
if (dest == MAP_FAILED)
{
perror("mmap(fbptr) failed");
return 1;
}
fbvar.bits_per_pixel = info_ptr->pixel_depth;
ret = ioctl(fd, FBIOPUT_VSCREENINFO, &fbvar);
if (ret == -1)
perror("ioctl(FBIOPUT_VSCREENINFO)");
memset(dest, 0, destsize);
switch (info_ptr->pixel_depth)
......@@ -105,20 +113,32 @@ int main(int argc, char *argv[])
width = info_ptr->width;
if (width > fbvar.xres_virtual)
width = fbvar.xres_virtual;
dst += (fbvar.xres_virtual-width) / 2 * 3;
dst += (fbvar.xres_virtual-width) / 2 * fbvar.bits_per_pixel / 8;
for (h = 0; h < height; h++)
{
unsigned char *src = row_ptr[h];
int len = width;
while (len--)
{
*dst++ = src[2];
*dst++ = src[1];
*dst++ = src[0];
src += 3;
if (fbvar.bits_per_pixel == 32) {
while (len--)
{
*dst++ = src[2];
*dst++ = src[1];
*dst++ = src[0];
src += 3;
dst++;
}
} else {
while (len--)
{
*dst++ = src[2];
*dst++ = src[1];
*dst++ = src[0];
src += 3;
}
}
dst += fbvar.xres_virtual - width;
dst += (fbvar.xres_virtual - width)
* fbvar.bits_per_pixel / 8;
}
break;
}
......@@ -135,4 +155,3 @@ int main(int argc, char *argv[])
return 0;
}
# find gpiochip by name (label)
# use $(findgpiochip "name")/base to get the base gpio number
LIST=false
if [ "$1" = "-a" ]
then
LIST=true
shift
fi
for dev in /sys/class/gpio/gpiochip*
do
$LIST && cat $dev/label
if [ "$(cat $dev/label 2>/dev/null)" = "$1" ]
then echo $dev
exit 0
fi
done
$LIST || exit 1
\ No newline at end of file
......@@ -22,6 +22,8 @@ fi
UIMAGE="/boot/uImage" # the uImage on the SD card
[ -x /etc/init.d/qtmoko-gta04 ] && /etc/init.d/qtmoko-gta04 stop
# copy only modules for the current kernel
MODULES=$(mkimage -l "$UIMAGE" | fgrep "Image Name:" | sed 's/Image Name: *//' | sed 's/Linux-//')
......@@ -174,7 +176,7 @@ do
tar -cf - $THEMODULES | (mkdir -p /flash-test && cd /flash-test && tar xpf - --checkpoint=100)
read FUSED PERIOD < <(du -s -m /flash-test 2>/dev/null)
echo "Reduced root file system wants to copy ${FUSED} MB to NAND flash"
echo "Reduced root file system wants to copy ${FUSED} MB to ${NANDSIZE} MB NAND flash"
if [ $USED -lt 1 -o $FUSED -gt $NANDSIZE ]
then
......@@ -185,7 +187,6 @@ do
exit 1
fi
rm -rf /flash-test
exit
;;
* ) echo unknown option "$cmd"
echo "-x x-loader [better done by boot-system]"
......@@ -258,9 +259,11 @@ then
fi
fi
flash_erase /dev/mtd3 0 0 &&
echo writing $UIMAGE
nandwrite -p /dev/mtd3 "$UIMAGE" || exit 1
if [ "$DTB" ]
then
echo writing ${DTB}.dtb
nandwrite -p /dev/mtd3 -s 0x5c0000 "/boot/${DTB}.dtb" || exit 1
fi
;;
......@@ -305,7 +308,7 @@ fi
;;
-u ) echo flashing Rootfs as UBIFS
if fgrep -q 'root=/dev/mtdblock4' /proc/cmdline
then
echo "can't overwrite active rootfs"
......@@ -359,4 +362,6 @@ fi
esac
done
[ -x /etc/init.d/qtmoko-gta04 ] && /etc/init.d/qtmoko-gta04 start
echo "done."
\ No newline at end of file
......@@ -6,25 +6,23 @@
SERIAL=$(/root/gps-on)
echo "### starting gpsd $SERIAL ###"
killall gpsd # kill any existing
killall gpsd # kill any existing
gpsd $SERIAL
rfkill unblock gps # potentially enable VSIM
ANTENNA_STATE=$(cd /sys/devices/platform/antenna-detect/input/input*/ && ls -1d event*) 2>/dev/null
# GTA04 only
[ -r /sys/class/gpio/gpio144/value ] || echo 144 >/sys/class/gpio/export # 2>/dev/null
# VSIM is only enabled if we open </dev/ttyO1
EXTANT="$((sleep 0.1; cat /sys/class/gpio/gpio144/value) 2>/dev/null </dev/ttyO1)"
# echo $EXTANT
case "$EXTANT" in
0 )
echo "### internal antenna ###"
;;
1 )
echo "### external antenna ###"
;;
esac
[ -r /sys/class/gpio/gpio144/value ] && echo 144 >/sys/class/gpio/unexport 2>/dev/null
if [ "$ANTENNA_STATE" ]
then
(
sleep 0.1
if evtest --query /dev/input/$ANTENNA_STATE EV_SW 13 2>/dev/null
then
echo "### internal antenna ###"
else
echo "### external antenna ###"
fi
) <$SERIAL # GTA04: VSIM is only enabled if we open the GPS port
fi
echo "### starting foxtrot gps ###"
. /root/x
......
......@@ -5,12 +5,12 @@
# usage: gps-on
#
rfkill unblock gps # turn on LNA etc.
case "$(cat /sys/firmware/devicetree/base/model)" in
*GTA04*/Letux* )
if [ -r /dev/ttyGPS0 ]
then echo /dev/ttyGPS0
else echo /dev/ttyO1
fi
# print first file we find
ls -1 /dev/ttyGPS0 /dev/gnss0 /dev/ttyO1 2>/dev/null | head -1
exit
;;
esac
......@@ -39,27 +39,31 @@ case "$IF" in
exit 1
(
echo "AT^SDPORT=4"; sleep1 # switch to multiplexed data mode
) | ./femtocom $IF >&2
) | /root/femtocom $IF >&2
echo should now make modem re-enumerate and restart this script
;;
/dev/ttyACM1 ) # PLS8
(
echo 'AT^SGPSC="Engine","1"'; sleep 1 # enable GPS
echo 'AT^SGPSC="Nmea/Output","on"'; sleep 1 # enable data stream
echo 'AT^SGPSC="Power/Antenna","on"'; sleep 1 # turn on LNA
echo 'AT^SGPSC="Power/Antenna","auto"'; sleep 1 # switch to auto mode
) | ./femtocom $IF >&2 &
# note: * commands report "+CME ERROR: operation failed" if the setting is already done
echo 'AT^SGPSC="Engine","0"'; sleep 0.2 # must turn off before enabling GLONASS
echo 'AT^SGPSC="Nmea/Glonass","on"'; sleep 0.2 # * enable GLONASS
echo 'AT^SGPSC="Engine","1"'; sleep 0.2 # enable GPS
echo 'AT^SGPSC="Nmea/Freq",1'; sleep 0.2 # once a second
echo 'AT^SGPSC="Nmea/Output","on"'; sleep 0.2 # enable data stream
echo 'AT^SGPSC="Nmea/Urc","on"'; sleep 0.2 # unsolicited reports
echo 'AT^SGPSC="Power/Antenna","auto"'; sleep 0.2 # * switch LNA to auto mode
) | /root/femtocom $IF >&2 &
echo /dev/ttyACM2
;;
/dev/ttyUSB[0-4] ) # PHS8 in mutiplexed mode
(
echo 'AT^SGPSC="Engine","1"'; sleep 1 # enable GPS
echo 'AT^SGPSC="Nmea/Output","on"'; sleep 1
echo 'AT^SGPSC="Power/Antenna","on"'; sleep 1
echo 'AT^SGPSC="Power/Antenna","auto"'; sleep 1
) | ./femtocom $IF >&2 &
echo 'AT^SGPSC="Engine","1"'; sleep 0.2 # enable GPS
echo 'AT^SGPSC="Nmea/Output","on"'; sleep 0.2 # normal output
echo 'AT^SGPSC="Power/Antenna","on"'; sleep 0.2 # turn on LNA
echo 'AT^SGPSC="Power/Antenna","auto"'; sleep 0.2 # switch to auto mode
) | /root/femtocom $IF >&2 &
echo /dev/ttyUSB1
;;
......
#
# start PVR SGX GPU
# and run some demo
#
# usage: gpu-demo
#
# WARNING: this loads and installs packages with NON-FREE
# firmware for the SGX libraries and runtime support from
#
# http://download.goldelico.com/letux-debian-rootfs/debian/dists/jessie/main/binary-armhf/omap3-pvrsgx530-gta04_0.20130811195126_armhf.deb
#
# It needs a kernel where the GPL'ed SGX kernel driver is
# properly configured.
#
# autodetect package version to load
PACKAGE=$(egrep -ao '[a-z0-9]*-sgx[0-9]*-[0-9]*' </proc/device-tree/ocp*/gfx@*/compatible)
COMPATIBLE=$(echo "$PACKAGE" | tr '-' '_')
echo autodetected driver package: $PACKAGE
echo compatible driver: $COMPATIBLE
PACKAGE=omap3-pvrsgx530-gta04 # version detection does not work and we don't have separate pvrsgx-121 / pvrsgx-125 packages
DIR=/usr/local/bin
# board sepcific fixes
case "$(cat /sys/firmware/devicetree/base/model)" in
*GTA04* | *Pandora* | *BeagleBoard* | *BeagleBone* | *'Letux Cortex 8'* )
;;
*Panda* )
PACKAGE=omap4-pvrsgx540-120
;;
*Pyra* | *omap5* | *'Letux Cortex 15'* )
PACKAGE=omap5-sgx-ddk-um-linux # from /e/a/s/pyra.list
;;
* )
echo "unsupported device; $(cat /sys/firmware/devicetree/base/model)"
exit 1
;;
esac
# make us locate the pvr tools in PATH
case $PACKAGE in
omap5-* ) PATH=$PATH:/opt/$PACKAGE/bin;;
esac
# fetch the microkernel binary and libraries
[ "$(which pvrsrvctl)" ] || apt-get install -y --force-yes $PACKAGE
# if automatic kernel module loading was blocked, load it now