Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > iRex > iRex Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 10-22-2006, 02:20 PM   #1
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
displayMgrClient protocol

OK, got this all figured out.

Port number is 50555.

Code:
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:

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:

Code:
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...

Last edited by scotty1024; 10-22-2006 at 02:40 PM. Reason: Added tested client code
scotty1024 is offline   Reply With Quote
Old 10-22-2006, 02:53 PM   #2
scotty1024
Banned
scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.scotty1024 is no ebook tyro.
 
Posts: 1,300
Karma: 1479
Join Date: Jul 2006
Location: Peoples Republic of Washington
Device: Reader / iPhone / Librie / Kindle
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...
scotty1024 is offline   Reply With Quote
Advert
Old 03-12-2010, 08:31 PM   #3
ericshliao
Guru
ericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enough
 
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
Yes, this is a quite old thread.
I raised this thread just to share what I found in iRex DR series GTK+ patches. If somebody want to incoporate eink update in his C code, here it is (extracted from eink-display-update.patch from iRex):

Quote:
+// IREX
+// create connection to displayMgr
+void irex_display_init(char addr[], int port) {
+ if (irex_display_socket==-1) {
+ irex_display_socket = socket(PF_INET, SOCK_DGRAM, 0);
+ irex_display_addr.sin_family = AF_INET;
+ irex_display_addr.sin_port = htons(port);
+ irex_display_addr.sin_addr.s_addr = inet_addr(addr);
+ irex_pid = getpid();
+ memset(irex_display_addr.sin_zero, '\0', sizeof irex_display_addr.sin_zero);
+ }
+}
+
+// IREX
+// send a display update message
+void irex_display_update(int x, int y, int width, int height) {
+ char msg[256];
+ irex_display_init("127.0.0.1",50555);
+ sprintf(msg,"!I,%d,%d,%d,%d,%d,%d,%d,%d,%s,%d",
+ irex_pid,
+ x, y, width, height,
+ irex_dump_ignore,
+ irex_dump_is_window,
+ irex_dump_window_type,
+ irex_dump_widget_type,
+ irex_dump_focus);
+ //printf("Sent update message: %s\n", msg);
+ sendto(irex_display_socket, msg, strlen(msg), 0,
+ (struct sockaddr*)&irex_display_addr, sizeof(irex_display_addr));
+ irex_dump_focus = 0;
+}
ericshliao is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
e-Book Care and Protocol. sceadugenga General Discussions 46 08-22-2010 02:09 AM
Whispernet Protocol xeijix Kindle Developer's Corner 1 03-08-2009 10:22 PM
PC sync protocol dumky Which one should I buy? 2 01-04-2008 01:33 PM
Skype protocol cracked for real? Alexander Turcic Lounge 0 07-15-2006 08:10 AM
Skype protocol disassembled TadW Lounge 0 01-27-2005 07:11 AM


All times are GMT -4. The time now is 01:29 AM.


MobileRead.com is a privately owned, operated and funded community.