Shiny New E-Book Gizmo: The Amazon Kindle


View Full Version : displayMgrClient protocol


scotty1024
10-22-2006, 01:20 PM
OK, got this all figured out.

Port number is 50555.

root@ereader:/usr/bin# displayMgrClient -d 10.0.1.2

From: /10.0.1.3 length: 6 data: 21302c312c30 ascii: !0,1,0

root@ereader:/usr/bin# displayMgrClient -d 10.0.1.2 -t

From: /10.0.1.3 length: 21 data: 21312c312c302c342c3939362c3730302c31303230 ascii: !1,1,0,4,996,700,1020

root@ereader:/usr/bin# displayMgrClient -d 10.0.1.2 -p

From: /10.0.1.3 length: 22 data: 21312c312c302c3130302c3130302c3330302c333030 ascii: !1,1,0,100,100,300,300
From: /10.0.1.3 length: 22 data: 21312c312c302c3530302c3730302c3730302c393030 ascii: !1,1,0,500,700,700,900

Example server code:

import java.net.DatagramSocket;
import java.net.DatagramPacket;

public class Display {

public static void main(String[] args)
throws Exception
{
byte[] buf = new byte[256];
DatagramSocket s = new DatagramSocket(50555);
DatagramPacket p = new DatagramPacket(buf, 256);
while (true) {
s.receive(p);
System.out.println("From: " + p.getAddress() + " length: " + p.getLength() + " data: " + toHexString(buf, p.getLength()) + " ascii: " + new String(buf, 0, p.getLength()));
}
}

public static String toHexString(byte bytes[], int length) {
StringBuffer retString = new StringBuffer();
for (int i = 0; i < length; ++i) {
retString.append(Integer.toHexString(0x0100 + (bytes[i] & 0x00FF)).substring(1));
}
return retString.toString();
}
}

Example client code to refresh entire display from Wonka:

import java.net.DatagramSocket;
import java.net.DatagramPacket;
import java.net.InetAddress;

public class Client {

public static final int DISPLAY_MGR_PORT = 50555;
private static final byte[] ENTIRE_DISPLAY = "!0,1,0".getBytes();

public static void main(String[] args)
throws Exception
{
refreshEntireDisplay();
}

public static void refreshEntireDisplay()
throws Exception
{
DatagramPacket p = new DatagramPacket(ENTIRE_DISPLAY,
ENTIRE_DISPLAY.length,
InetAddress.getLocalHost(),
DISPLAY_MGR_PORT);
DatagramSocket s = new DatagramSocket();
s.send(p);
s.close();
}
}

Tested, works. :)

Now I just need to go find where to bury the code in Wonka's AWT implementation...

scotty1024
10-22-2006, 01:53 PM
By the way, Java's AWT understands and calculates updated area information.

I just need to hook that and send the update area message to the display manager.

When you press a button, just the button will be erased and re-drawn. Should be every bit as smooth as everyone wants.

I suspect iRex's issue with doing partial updates from X is what to do when multiple things are redrawn at the same time. X will produce multiple update areas which would look kinda strange. I'll have Java composite the areas and thus send one larger update area so you only get one blink.

Wonka also supports writing directly to the standard linux fbdev. At some point it might be possible to just take down the X server entirely...