Agenda VR3 - Programming Details
Chris "Crossfire" Collins <firstname.lastname@example.org>
The Agenda VR3 runs a Linux VR kernel, configured to load a cramfs filesystem known as the romdisk as root.
The romdisk is intended to be stored in ROM (its stored in flash in the developers edition) and it contains the Root Filesystem, the core software (like the X server itself, runtime libraries, and other essential files) and all the defaults for the flash filesystem.
When the Agenda boots, this kernel is mounted on /, and invokes BusyBox as init. This causes init to load the /flash/etc/inittab on the romdisk itself, and start booting by mounting the flash ram on /flash, a ramfs on /ram, initialising default state of the ramdisk, and then passing control to the init scripts on the flash filesystem.
Once the SysV-like part of the init process is complete, init starts the vrdm, which in turn invokes the local X server. vrdm is started without respawning enabled.
The Flashdisk runs a jffs filesystem which contains user installed software, user data and user preferences for the Agenda.
The Matrix image makes this area availible via a rsync server as an export named 'vr3'.
On a Developers VR3, there is about 3.1MBs availible for use as a flashdisk with the current images installed.
The Agenda looks like any other linux machine in most regards, however there are a few notable differences in the availible devices and their data format.
Most linux kernel implementations use /proc/apm to read the status of the battery - however, the VR3 kernel lacks a /proc/apm device - instead the battery status utility uses /dev/adif, a device to access the power regulator/controller on the VR3.
Data from /dev/adif is read as a block of 4 unsigned short integers, the first of which contains an integer scaled such that 0 is 0 volts, and 1024 is 3.3 Volts.
The source from vru/power states that operational voltage range is 1.8V to 3.0V, and hence uses the values 558 for 0% battery capacity, and 930 for 100% battery capacity.
The VR3's framebuffer device is a extended linux fbconsole device.
It contains extensions for backlight and contrast control.
The contrast can be adjusted using ioctl's to the /dev/fb0 device.
The ioctl's are defined as such:
#define FBIOGET_CONTRAST 0x4622 #define FBIOPUT_CONTRAST 0x4623
For FBIOGET_CONTRAST, the argument is a pointer to a unsigned long (4 byte) integer. The return value contains the current contrast setting for the display.
For FBIOPUT_CONTRAST, the argument is a int (32 bit signed integer) which contains the new contrast setting.
The vru/contrast application defines the useful range for this ioctl to be from 70 (light) to 120 (dark).
The backlight can be activated and deactivated using the FBIOGET_BACKLIGHT and FBIOPUT_BACKLIGHT ioctls against the /dev/fb0 device.
For FBIOGET_BACKLIGHT, the argument is a pointer to an int (32 bit signed integer) which is set to the state of the backlight.
For FBIOSET_BACKLIGHT, the argument is an unsigned char which contains the new state of the backlight.
gbm, the Button Manager which controls the state of the backlight by default, uses the values 0 and 1 to control backlight state.
The Agenda has 2 classes of buttons, GPIO buttons, and KUI buttons.
The Power, Pen and Battery Cover buttons all generate GPIO events, whereas the other buttons generate KUI events.
GPIO button events can be read off of /dev/vrbuttons.
The header, linux/buttons.h contains the definitions for GPIO buttons.
KUI key events can be read direct off of /dev/tty0
|0x30||0xB0||Left Top (Page Up)|
|0x20||0xA0||Left Mid (Pg Down)|