Technologies:

C Python LINUX


First of all big thank you to the people at https://linux-sunxi.org/Main_Page.

After 2-3 days I managed to extract all the data needed for the device trees and compiled the kernel. After that, another 2-3 days keet me up late at night going over the rtl8188eu driver and the configuration of the lcd.

Currently there is a bug with the usb hub and after the X startup the mouse is not recognized so I had to write a small script to reset the usb hub.

I had to init the lcd backlight via a small bash script:
echo "224" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio224/direction
echo "0" > /sys/class/gpio/gpio224/value
echo "230" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio230/direction
echo "1" > /sys/class/gpio/gpio230/value


Then I had to probe around in the /dev/input/event0 for the volume up and down keys so I can control the lcd and reset the usb hub.
After some work I wrote the Python script: import struct
import os
import sys

#inputDevice = sys.argv[1]
inputDevice = "/dev/input/event0"

inputEventFormat = 'iihhi'
inputEventSize = 16
file = open(inputDevice, "rb")
event = file.read(inputEventSize)

lcdStatus = True;
lcdDimmed = 0;

os.system("echo 224 > /sys/class/gpio/export");
os.system('echo "out" > /sys/class/gpio/gpio224/direction');
os.system('echo 0 > /sys/class/gpio/gpio224/value');
os.system("echo 230 > /sys/class/gpio/export");
os.system('echo "out" > /sys/class/gpio/gpio230/direction');
os.system('echo 1 > /sys/class/gpio/gpio230/value');


def lcdOnOff(flag):
global lcdStatus
print("flag=", flag)
print("lcdStatus=", lcdStatus)
if flag==True:
print("1");
lcdStatus = True
os.system('echo 1 > /sys/class/gpio/gpio230/value')
else:
print("0");
lcdStatus = False
os.system('echo 0 > /sys/class/gpio/gpio230/value')

def usbReset():
os.system(
"/platform/usbreset /dev/bus/usb/004/001 ;"
"sleep 2;"
"/platform/usbreset /dev/bus/usb/004/002 ;"
"sleep 2;"
"/platform/usbreset /dev/bus/usb/004/003 ;"
"sleep 2;"
"/platform/usbreset /dev/bus/usb/004/007 ;"
"sleep 2;"
"dhclient -r wlan0;"
"sleep 2;"
"dhclient wlan0")

while event:
(time1, time2, type, code, value) = struct.unpack(inputEventFormat, event)

print "code %d, value %d" %(code, value)

if value==1 and code==115:
lcdOnOff(not lcdStatus)

if value==1 and code==114:
usbReset()

event = file.read(inputEventSize)

file.close()

The target for this project is to run a browser in a KIOSK like mode.