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 03-23-2008, 07:12 PM   #1
Antartica
Evangelist
Antartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-books
 
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
xepdmgr - another approach to auto-refresh

NOTE: I'll keep this first post updated with the last version of xepdmgr, as well as some instructions for use. I've not done up to now, and it's getting messy to find the last version in this thread.

xepdmgr is a program that allows developers of the iliad to port programs without being forced to insert "update the screen" commands in the ported programs (and it's very prone to errors in the menus and and dialogs). "Update the screen" commands can be issued with xepdmgr running using the included library (xepdmgrclient.c).

xepdmgr works by launching the ported program using xepdmgr as a wrapper, and while the program is launched, xepdmgr will auto-refresh the screen when needed. For example, to launch mycalculator using xepdmgr, you will substitute in your run.sh file the line:
Code:
./mycalculator
with
Code:
./xepdmgr :0 ./mycalculator
You only have to include the xepdmgr binary in your package, in the same directory as your program binary (in the same directory as mycalculator in the example).

Posts with the different versions uploaded to this thread:
#4 9-09-2008 xepdmgr 1.0pre1 with instructions
#5 9-20-2008 xepdmgr 1.0, first usable version
#8 9-24-2008 xepdmgr 1.1 using iliad's internal libX11.so
#13 10-02-2008 xepdmgr 1.2 with busy led off and refresh bugs fixed
#35 10-04-2008 xepdmgr 1.3 with multiple tracked areas working
(note to self: #37 has Hansel's code for detecting matchbox-keyboard).
(note for devels: #47 has sample code for disabling auto-update wile initializing your app)
#53 12-08-2008 xepdmgr 1.9, xepdmgr 1.9a, xepdmgr 1.9b Less verbose output
#74 12-16-2008 xepdmgr 1.9c. Contains some code to notify contentLister of the updates when running as server
#92 03-26-2009 xepdmgr 1.9d. Adds option for operating as wrapper but not launching any programs (using the iliad for displaying exported windows)
#94 04-13-2009 xepdmgr 1.9e. Fixed a parameter parsing bug introduced in 1.9d
#101 04-25-2009 xepdmgr 1.9f. Adds EpdCancel() to xepdmgrclient, to support updating the screen using fbdev from applications a-la-ipdf. See post #99 for usage and rationale.
#127 08-22-2009 xepdmgr 1.9g. Make xepdmgrclient.h usable in C++.
#136 09-12-2009 xepdmgr 1.9h. Hopefully fixed a bug that made "autorefresh-disable" non-working. Make xepdmgrclient.c usable in C++.
#146 09-18-2009 xepdmgr 1.9i. New dirty area management; it is a lot more consistent in regard to typing/full refreshes than before.

Remaining TO-DO for version 2.0:
- exclude the matchbox keyboard area when running as a wrapper
- make xepdmgr when in wrapper mode to detect that there is another instance running in server mode so that they doesn't clash.

----------------------------------------------
Original message follows:
Hi all!

I've managed to get time to start coding xepdmgr (another approach to auto-refresh). The proof-of-concept code is attached to the main page of the wiki of the project:

https://dev.mobileread.com/trac/xepdmgr/wiki/WikiStart


The code itself is attached to the main page of the wiki.

It doesn't do much right now (only shows that "dirty" rectangles in stdout).

Last edited by Antartica; 01-08-2010 at 09:39 AM.
Antartica is offline   Reply With Quote
Old 03-24-2008, 07:32 AM   #2
Adam B.
Addicted to Porting
Adam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the rough
 
Adam B.'s Avatar
 
Posts: 1,695
Karma: 7194
Join Date: Oct 2006
Location: Indianapolis, IN
Device: iRex iLiad, Nokia 770, Samsung i760
Great idea! Getting refreshes to work with menus and such has always been the hardest part of porting... I'm very much looking forward to a working version.

Great work Antartica!
Adam B. is offline   Reply With Quote
Old 03-28-2008, 09:28 AM   #3
yokos
Pac-Man catched my iLiad.
yokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with othersyokos plays well with others
 
yokos's Avatar
 
Posts: 720
Karma: 2571
Join Date: Apr 2006
Location: Germany; next to Baltic Sea
Device: 1st gen iRex iLiad with 2nd ed. battery/case
Interesting. Src was downloaded & now I "compile some extra time" to check it out.
yokos is offline   Reply With Quote
Old 09-07-2008, 06:16 PM   #4
Antartica
Evangelist
Antartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-books
 
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
I've finished the first version of xepdmgr, but I've to recompile the X libraries for the iliad as I don't have the needed libXdamage.so.1 and related headers in the scratchbox environment

Anyway, if someone wants to look at how it's at the moment and try it in his desktop (you will have a nice line in stdout when the iliad refresh would be invoked), here it is.

To compile, just do "make" in the directory.

It has two modes of being used, as an standalone server and as a wrapper for one program only.

As a standalone server:
1. In one window launch ./xepdmgr :0
2. In another window exec ./xepdmgrtest
3. To futher tests, exec ./xepdmgrtest --help
4. When you want to stop the server, just hit Ctrl-C in the server window

As a wrapper for one program only:
1. Just exec ./xepdmgr :0 ./xepdmgrtest
(or ./xepdmgr :0 xterm)
2. When you exit the launched program, xepdmgr also exits

I'll document the inner workings and the meaning of the different commands that can be send with xepdmgrtest on another messsage, as today is somewhat late for me :-).

OTOH, the xepdmgrclient.h and xepdmgrclient.c are intended to be included in your programs to be able to communicate with the server; see xepdmgrtest.c for an example. Multiple clients are allowed at once, but races can occur in that case (if two programs send a message to the server in the same exact moment, one of the messages will be lost).

Something that makes this interesting as an alternative to the hacked libX11 is that [when I manage to compile xepdmgr for the iliad] the problem of having exported windows on the iliad will vanish, as they would auto-refresh correctly ;-).

Advantages of this approach:
- lets the application force refreshes (or delay them) when needed, unlike the hacked libX11.
- Has some heuristics as to when to use the full refresh or the Typing refresh, as it knows how big the portion to refresh is (for small portions it will use the Typing refresh, and for large portions the Full refresh).

Enjoy your hacking!
Attached Files
File Type: gz xepdmgr-1.0pre1.tar.gz (10.1 KB, 449 views)
Antartica is offline   Reply With Quote
Old 09-20-2008, 09:37 AM   #5
Antartica
Evangelist
Antartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-books
 
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
First version of xepdmgr for the iliad (untested, but it should work O:-)

Hi all!

Attached is the first version of xepdmgr for the iliad. I've not tested it, but it should work ;-).

Happy hacking!
Attached Files
File Type: gz xepdmgr-1.0-iliad.tar.gz (322.1 KB, 455 views)
Antartica is offline   Reply With Quote
Old 09-20-2008, 11:29 AM   #6
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Great!
How big is the stripped xepdmgr? Just curious... Why not link the standard Xlibs that are available on every Iliad? The stripped executable would be only 23KB...

Last edited by hansel; 09-20-2008 at 11:48 AM.
hansel is offline   Reply With Quote
Old 09-20-2008, 03:43 PM   #7
Antartica
Evangelist
Antartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-books
 
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
Quote:
Originally Posted by hansel View Post
Great!
How big is the stripped xepdmgr? Just curious... Why not link the standard Xlibs that are available on every Iliad? The stripped executable would be only 23KB...
Code:
dario@calcifer:/shared/Devel/iliad/src.xepdmgr/xepdmgr-1.0-iliad$ ls -l xepdmgr
-rwxrwxr-x 1 dario dario 224692 2008-09-20 16:01 xepdmgr
The reason of including libX11 in the executable was to be in the safe side as I didn't know if the Xdamage extension used internal structures of libX11 that might have changed between the iliad version and the last xorg released version that I was using.

As you have tested that it works with the included libX11, your approach makes a lot more sense than mine ;-).

I'll post here a version that uses the iliad's internal libX11.so library as soon as possible (but that might not be very soon, anyway...).
Antartica is offline   Reply With Quote
Old 09-24-2008, 08:55 AM   #8
Antartica
Evangelist
Antartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-books
 
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
Quote:
Originally Posted by Antartica View Post
I'll post here a version that uses the iliad's internal libX11.so library as soon as possible (but that might not be very soon, anyway...).
Here it is, a version that uses iliad's internal libX11.so

It should compile in Adam's VMWare development image. If not, warn me about it ;-).
Attached Files
File Type: gz xepdmgr-1.1-iliad.tar.gz (63.4 KB, 448 views)
Antartica is offline   Reply With Quote
Old 10-01-2008, 07:13 AM   #9
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Hi Antartica,

I had some playtime... xepdmgr.c compiles fine, but... has some cut&paste errors causing to much full refreshes...

Code:
148,149c148,149
<                                         Epd->ux1=Epd->x1,Epd->uy1=Epd->x1;
<                                         Epd->ux2=Epd->x2,Epd->ux2=Epd->x2;
>                                         Epd->ux1=Epd->x1,Epd->uy1=Epd->y1;
>                                         Epd->ux2=Epd->x2,Epd->uy2=Epd->y2;
358c358
<                                                Epd->ux1,Epd->uy1,Epd->ux2,Epd->ux2);
>                                                Epd->ux1,Epd->uy1,Epd->ux2,Epd->uy2);
365c365
<         Epd->ux1=Epd->uy1=Epd->ux2=Epd->ux2;
>         Epd->ux1=Epd->uy1=Epd->ux2=Epd->uy2;
hansel is offline   Reply With Quote
Old 10-01-2008, 09:07 AM   #10
Antartica
Evangelist
Antartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-books
 
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
Quote:
Originally Posted by hansel View Post
I had some playtime... xepdmgr.c compiles fine, but... has some cut&paste errors causing to much full refreshes...
Ups! Thanks a lot. I'll post a fixed version with the path applied this night.

OTOH, I've decided how to do the improvement you suggested in the other thread about tracking several areas at once. I'll try to implement that tonight too .
Antartica is offline   Reply With Quote
Old 10-01-2008, 11:56 AM   #11
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Quote:
Originally Posted by Antartica View Post
I'll try to implement that tonight too .
Great!

You might as well add code to kill the busy led... This is what I do in xepdmgr.c :

Code:
#ifndef DUMMY_BUILD
#include <liberdm/erdm.h>
#include <liberipc/eripcbusyd.h>
#endif
Code:
        if(argc>2) {
                /* Start child process */
                install_signal(SIGCHLD,sigchld);
                if((child_pid=fork())==0) {
                        erClientChannel_t erbusyChannel;
                        erIpcStartClient(ER_BUSYD_CHANNEL, &erbusyChannel);
                        busySetBusy(erbusyChannel, ccBusyState_Off);
                        int fd;
                        /* Close unneeded fds */
hansel is offline   Reply With Quote
Old 10-01-2008, 01:16 PM   #12
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Cool Even better...

I played some more, and managed to enable the keyboard button on the tool bar. With the following mutation to xepdmgr.c the virtual keystrokes go to my unmodified test app (no specific Iliad stuff in it)

Code:
#ifndef DUMMY_BUILD
#include <liberdm/erdm.h>
#include <liberipc/eripcbusyd.h>
#include <liberipc/eripctoolbar.h>
#endif
Code:
        if(argc>2) {
                /* Start child process */
                install_signal(SIGCHLD,sigchld);
                if((child_pid=fork())==0) {
                        erClientChannel_t erbusyChannel;
                        erClientChannel_t ertoolbarChannel;
                        erIpcStartClient(ER_BUSYD_CHANNEL, &erbusyChannel);
                        busySetBusy(erbusyChannel, ccBusyState_Off);
                        erIpcStartClient(ER_TOOLBAR_CHANNEL, &ertoolbarChannel);
                        tbSelectIconSet(ertoolbarChannel, ER_PDF_VIEWER_UA_ID);
                        tbClearIconSet(ertoolbarChannel, ER_PDF_VIEWER_UA_ID);
                        int fd;
                        /* Close unneeded fds */
PS: Scotty1024: thanks for your old posts!!!
hansel is offline   Reply With Quote
Old 10-01-2008, 08:06 PM   #13
Antartica
Evangelist
Antartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-books
 
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
Version 1.2 of xepdmgr

Hi!

Here it is, attached is v1.2 of xepdmgr.

Includes the fixes and changes proposed by Hansel, as well as an implementation of the multiple tracking areas to minimize full refreshes.

Thanks a lot, Hansel!

BTW, the code you posted for the initial busy led and the keyboard was familiar to me; it's surprinsingly similar to the one in the hacked libX11 (I used those same posts...).

P.S.: As always, I've not tested it in the iliad (time is scarce et al.)... Thanks in advance for your testing ;-).
Attached Files
File Type: gz xepdmgr-1.2-iliad.tar.gz (66.2 KB, 387 views)
Antartica is offline   Reply With Quote
Old 10-02-2008, 08:16 AM   #14
Antartica
Evangelist
Antartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-books
 
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
Quote:
Originally Posted by Antartica View Post
Here it is, attached is v1.2 of xepdmgr.
This release has at least two bugs related to the multiple tracked areas part:
1. Due to a badly put end condition (tracked_areas_num instead of tracked_areas_num-1) in the code to search for the best candidate merge areas, it will merge always with the first area, as he last one always has merge_with==0, merge_overhead==0.
2.I forgot to consider intersections of the tracked_areas when calculating the final area span. It's simply a matter of putting the code to calculate the intersection of two areas used in the MergeOne function in a separate function and use it when calculating the final area span.

I'll do it soon .
Antartica is offline   Reply With Quote
Old 10-02-2008, 12:25 PM   #15
Adam B.
Addicted to Porting
Adam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the rough
 
Adam B.'s Avatar
 
Posts: 1,695
Karma: 7194
Join Date: Oct 2006
Location: Indianapolis, IN
Device: iRex iLiad, Nokia 770, Samsung i760
I've just tested this program for the first time on a ported app without any internal refreshes. I have to say, Antartica, you're a genius!

It works great, and should make porting *much* easier. Now I have to decide what my first Xepdmgr based release will be.
Adam B. 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
Psychological Approach shalini_singh Lounge 5 09-09-2009 05:33 AM
New to Sony Reader - Best Approach kougei Sony Reader 11 12-23-2008 11:42 PM
iLiad xepdmgr algorithms dicussion thread Antartica iRex Developer's Corner 14 11-17-2008 11:36 AM
emelFM2 0.41 with xepdmgr ericshliao iRex 0 10-06-2008 11:25 AM
iLiad libX11.so.6, auto refresh hansel iRex Developer's Corner 7 09-20-2008 09:40 AM


All times are GMT -4. The time now is 10:37 PM.


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