Home  Contents

DVI

Graphics Core4 Lua Commands

DESCRIPTION

As of SDK version 1.7.0 and later, the V4 and V4½ support driving displays through DVI.

Compared to directly attached displays, DVI supports hotplugging: the removal or conection of a display while the system is powered on.

Some new functions have been introduced so the application can properly react to hotplug events.

HOTPLUG EVENTS

The application can get notified if the hotplug state of the display changes.

To do so, obtain a handle to the framebuffer by calling gfx.open().

Then attach the handle to an event handler by calling event:add() on the framebuffer handle, asking for POLLIN events.

The event handler will be called whenever the gcx:linkState() changes. the application must read the link state from the event handler to acknowledge to the system that it has processed the event. Otherwise the event handler callback would be called repeatedly.

Example:

#include <lua/poll.lh> app = event.new() fb = gfx.open() local function hotplug_handler() print(string.format("HOTPLUG EVENT: %s", table.tostring(fb:linkState()))) end fbevh = app:add(fb, hotplug_handler, POLLIN)

REMOTE TTY

Some display assemblies can have auxillary features, like extra serial ports. The extra serial ports are controlled through the DVI cable to avoid having extra cables.

Due to the peculiar nature of this "tunneling", please note:

  • The remote serial ports are available as /dev/ttyBP0, /dev/ttyBP1, ...
  • The entries in /dev will appear once the display is fully initialized. Check gcx:linkState() for backplane_connected before attempting to use a remote serial port.
  • When the display is unplugged after one or more serial ports have been registered, the device driver for the remote serial port stays available. Attempting to read or write data results in the error ENODEV (No such device).
  • If you want to get notified when a serial port is plugged back in, watch for POLLOUT events on the device handle. (Don't forget to stop watching once the serial port is back.)
  • All remote serial ports, together with any other auxillary features of the display assembly, share a single I²C bus at about 100kBit/s bandwidth. This should barely support running one remote port at 38400 bps full duplex, but no guarantees are given.

REMOTE GPIO

Another optional auxillary feature is remote GPIO. Displays with remote GPIO have general purpose inputs and/or outputs that can be used for things like pushbuttons, indicator lights, electronic cash drawers, etc...

The remote GPIO is controlled with the same mechanism as any other GPIO of the controller. The group name is GPGRP_BACKPLANE.

The function gcx:backplaneVersion() provides information about the number of available inputs and outputs.

Whenever a display with GPIO features is plugged in or disconnected, all outputs go into the OFF state. The application should watch DVI hotplug events if it wants to initialize output states when a display is connected.

After power on or reset, the GPIO is unavailable until the backplane controller has been initialized. Again, the display hotplug event helps checking for this. Check gcx:linkState() for backplane_connected before attempting to use remote GPIO.

SEE ALSO