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 12-19-2008, 10:05 AM   #1
joana.estafanell
Junior Member
joana.estafanell began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2008
Device: iLiad
Problem Launching ipdf from other app

Hi all,

I'm launching the ipdf through a C application, let's call it "A", to show a .pdf document, but when I try to come back to the application "A" pushing the top left button, the iLiad refreshes the screen and displays the .pdf document again, getting impossible to come back to "A".

I paste here the code snippet where I call the ipdf to open a document:

int openPdf ()
{
pid_t childpid; /* variable to store the child's pid */
int status; /* parent process: child's exit status */

flush ();

/* now create new process */
childpid = fork();

if (childpid >= 0) /* fork succeeded */
{
if (childpid == 0) /* fork() returns 0 to the child process */
{
printf("CHILD: I am the child process!\n");
printf("CHILD: Here's my PID: %d\n", getpid());
printf("CHILD: My parent's PID is: %d\n", getppid());
printf("CHILD: The value of my copy of childpid is: %d\n", childpid);
printf("CHILD: Enter an exit value (0 to 255): ");

execlp ("/usr/bin/ipdf", "/usr/bin/ipdf", "/mnt/free/books/test/test.pdf");

flush ();

printf("CHILD: Goodbye!\n");
return 0;
}
else /* fork() returns new pid to the parent process */
{
printf("PARENT: I am the parent process!\n");
printf("PARENT: Here's my PID: %d\n", getpid());
printf("PARENT: The value of my copy of childpid is %d\n", childpid);
printf("PARENT: I will now wait for my child to exit.\n");

flush ();
wait(&status); /*wait for child to exit, and store its status*/
}
}
else /* fork returns -1 on failure */
{
perror("fork"); /* display error message */
return 0;
}

flush ();
}

Can anyone help me with this? Is there any other way to call to another application inside the iLiad different to 'fork' or using the manager process of iliad ??

Thanks!!

joana.

joana.estafanell is offline   Reply With Quote
Old 12-19-2008, 11:09 AM   #2
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
Do you have special code to process the top left button? I think that the two buttons above flip bar and NEWS, BOOKS, DOCS, NOTES are proprietary to contentlister. I haven't found a way to catch them as GdkEventKey. If I am right, then your app won't respond to those key press unless special connection to contentlister is established.

Added:
My above words might not be relevant to your problem. Ideally, when the top-left button is pressed, ipdf should exit. Then, one question: which process will be displayed on screen, your application "A" or contentlister?

Last edited by ericshliao; 12-19-2008 at 11:16 AM.
ericshliao is offline   Reply With Quote
Advert
Old 12-19-2008, 11:47 AM   #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
After a second thought, I want to ask you a question:
You said that
Quote:
the iLiad refreshes the screen and displays the .pdf document again
Did you mean that ipdf exited and then re-executed, or ipdf just didn't exit?
I guesss it should be the later case. Based on my understanding, ipdf started by contentlister will establish a ipc channel to communicate with contentlister, so that contentlister can pass NEWS, BOOKS, DOCS, NOTES and the two buttons above the flip-bar to ipdf. When ipdf is started by your application "A", maybe the IPC channel is not established, and you can't close ipdf by pressing the top-left key.
Well, these words are all conjecture. I don't know if they are correct.
ericshliao is offline   Reply With Quote
Old 12-19-2008, 04:02 PM   #4
Max
Connoisseur
Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.Max has a complete set of Star Wars action figures.
 
Max's Avatar
 
Posts: 79
Karma: 380
Join Date: Mar 2008
Location: Girona, Spain
Device: iLiad, DR1000s
Hi,

It seems that counter list sends the keypressed signals to your program instead to ipdf.

About the keypress signals, Counterlist catch that signals and re-send to the open programs. It only re-send the left side buttons signals (pageBar, arrow up, arrow down, dot, exit and previus).

If you have added your program in the register.xml, to cath this signals the program should have gtk wmclass and title equal to the value of xResourceName of the register. If you lauch your program form a shell script, you should put "sh"

see this thread about buttons pressed:

http://forum.irexnet.com/viewtopic.php?t=2366
Max is offline   Reply With Quote
Old 12-21-2008, 05:27 AM   #5
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
I just found a very informative old thread contributed by jharker. It should be the most detailed study on iLiad key press. See here.

Last edited by ericshliao; 12-21-2008 at 05:30 AM.
ericshliao is offline   Reply With Quote
Advert
Old 12-22-2008, 11:58 AM   #6
joana.estafanell
Junior Member
joana.estafanell began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2008
Device: iLiad
Thanks for your prompt answer. I´ve been checking your comments, but I still have the same problem.

Quote:
Originally Posted by ericshliao View Post
which process will be displayed on screen, your application "A" or contentlister?
This is the situation:
- First, I launch "A" application written in C.
- "A" app launchs ipdf
- I try to exit ipdf
- and if the behavior were ok, I will back to the "A" app

I hope this solve your question.

Quote:
Originally Posted by ericshliao View Post
Did you mean that ipdf exited and then re-executed, or ipdf just didn't exit?
Yes, it´s the second. The buttons NEWS, BOOKS, DOCS and NOTES reacts exactly like with the top left button, that means, I see a blink of the screen (I think that inside change to the proper directory) but the ipdf stills on top. If I press flipbar, the screen don´t blink and it doesn´t do anything.

@Max

I´m not sure if the signals are sent to my program instead to ipdf. I have test what you say to launch my app with sh (I tried 'sh -c myapp') but It still doesn´t work.

---

In short, I can´t exit or flippage inside the ipdf I have launched. I have realized that I have the same problem if I open a shell (or ssh) and open ipdf by command line.

Thanks,

joana.
joana.estafanell is offline   Reply With Quote
Old 12-22-2008, 12:20 PM   #7
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,697
Karma: 7194
Join Date: Oct 2006
Location: Indianapolis, IN
Device: iRex iLiad, Nokia 770, Samsung i760
The problem is that the contentlister doesn't know what application to send the keypresses to. It has to do with the IPC channel. You'll likely need to modify the contentlister to get multiple apps to function.
Adam B. is offline   Reply With Quote
Old 12-27-2008, 05:41 AM   #8
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
I think Joana probabily tried to make another interface ontop of CL. This thread stroke on a interesting topic and made me curious what does contentlister do when it starts another viewer. I found that, in "viewer.c" on contentlister, there is a fuction "gboolean viewerInit(char *viewer) ", when CL starts another viewer, CL will find the viewer's identity and setup a IPC channel for later communication. So, for viewers not stared by CL, CL won't know how to communicate with them. That's why Joana have the same problem if she open a shell (or ssh) and open ipdf by command line.

Then, a quite challenging question comes out: is it possible to make a middle-ware between CL and viewer, and enable IPC between CL and viewer? I think it's possible, but I don't know how to do it.
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
Pixelar (UK) is launching new ereader Ea News 19 11-13-2011 10:29 AM
iPad Problem with Kindle app DixieGal Apple Devices 5 04-18-2010 11:38 AM
Problem launching Calibre in OS X - depends on which USER Nigel Brooks Calibre 10 11-13-2009 02:37 AM
Beware, problem with Kindle App + your own .mobi/.prc thianliongpatpoh Apple Devices 0 08-15-2009 02:46 PM
ipdf problem - starting up the new versions ckbrooks iRex 5 02-18-2009 01:31 PM


All times are GMT -4. The time now is 08:57 AM.


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