Author Topic: Startup Script On Sharp 3.10 Rom  (Read 5089 times)

gregarican

  • Newbie
  • *
  • Posts: 24
    • View Profile
Startup Script On Sharp 3.10 Rom
« on: September 30, 2005, 12:38:26 pm »
I have an SL-5500 running Sharp ROM 3.10 and am looking for a way to run a script as root when the PDA finshes loading Qtopia. Here's the basic idea of the script:

#!/bin/sh

/usr/sbin/smbd -D
/usr/sbin/nmbd -D
/usr/bin/smbmount //server_box/share1 /mnt/share1 -o username=user%pass
/usr/bin/smbmount //server_box/share2 /mnt/share2 -o username=user%pass

I tried symlinking /etc/rc.d/rc.local to /etc/rc.d/rc5.d/S49local but this didn't get the job done. Since the Zaurus runs as the zaurus user and not the root use I am having problems running the script unless I connect in and su as the root user.

Figuring sudo would be a thing to try I installed the ipk for it but before I could even verify and configure the /etc/sudoers file the root user account got messed up.

So here I am back at a restore point where I am trying to get this script to launch as Qtopia is loaded up. What's the easiest way to do this?

gregarican

  • Newbie
  • *
  • Posts: 24
    • View Profile
Startup Script On Sharp 3.10 Rom
« Reply #1 on: September 30, 2005, 03:27:58 pm »
Here are two other questions related to my SL-5500 that I was wondering about:

1) Is there a way to launch HancomMobileWord from the command line with a filename as the argument? Something like

Code: [Select]
HancomMobileWord /home/zaurus/myDocument.doc
2) I would like to view TIF/TIFF files on the Zaurus. When I attempt to do so with the ImagePad application that comes with the Sharp ROM 3.10 I receive an error message stating 'The file wasn't opened.' Is there a recommended image viewer that I can use to view TIF/TIFF files?

Any pointers would be greatly appreciated.

Thanks!

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Startup Script On Sharp 3.10 Rom
« Reply #2 on: October 01, 2005, 06:16:55 am »
Quote
looking for a way to run a script as root when the PDA finshes loading Qtopia

iirc the init scripts stop when Qtopia is loaded so you can't use them.

Can you not do this before Qtopia is loaded? In which case add it to the init scripts, otherwise I'd add it to /etc/init.d/qpe (I think that's the name of the script which is used to start Qtopia - I'm not running it so this is from memory).

Quote
Is there a way to launch HancomMobileWord from the command line with a filename as the argument?

I imagine it requires a QCOP call to tell it which file to open.

No idea about the TIFFs I'm afraid.


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

gregarican

  • Newbie
  • *
  • Posts: 24
    • View Profile
Startup Script On Sharp 3.10 Rom
« Reply #3 on: October 01, 2005, 10:29:58 am »
Quote
Quote
looking for a way to run a script as root when the PDA finshes loading Qtopia

iirc the init scripts stop when Qtopia is loaded so you can't use them.

Can you not do this before Qtopia is loaded? In which case add it to the init scripts, otherwise I'd add it to /etc/init.d/qpe (I think that's the name of the script which is used to start Qtopia - I'm not running it so this is from memory).

Quote
Is there a way to launch HancomMobileWord from the command line with a filename as the argument?

I imagine it requires a QCOP call to tell it which file to open.

No idea about the TIFFs I'm afraid.


Si
[div align=\"right\"][a href=\"index.php?act=findpost&pid=97770\"][{POST_SNAPBACK}][/a][/div]
Thanks for the reply. I will check regarding the /etc/init.d/qpe file to see if I can start Samba and mount my network Samba shares that way. I did a ps -ax and saw that the HancomMobileWord process was followed by a qcop argument. What is the syntax if I wanted to launch a specific document? Something like /tmp/thisDocument.doc? Would I issue a command line of
Code: [Select]
HancomMobileWord -qcop /tmp/thisDocument.docIf you could provide me an example I'd be eternally grateful. Sorry for my ignorance. I used the Z back in 2002-2003 and just picked it up again for some Ruby/Qt projects I've been working on. Very rusty to say the least :-)

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Startup Script On Sharp 3.10 Rom
« Reply #4 on: October 01, 2005, 11:59:07 am »
I think you'd start Hancom Word, then issue the QCop call separately (though it's only a guess).

Here's a list of some commands: http://doc.trolltech.com/qtopia2.1/html/qcop.html

Though from my understanding each app can have it's own calls (there was an app floating round a while back which listed all of the calls being made - Japanese iirc, anyone remember what it was?)

In any case you may be okay with a plain "setDocument()" call.


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

gregarican

  • Newbie
  • *
  • Posts: 24
    • View Profile
Startup Script On Sharp 3.10 Rom
« Reply #5 on: October 01, 2005, 06:05:09 pm »
Quote
I think you'd start Hancom Word, then issue the QCop call separately (though it's only a guess).

Here's a list of some commands: http://doc.trolltech.com/qtopia2.1/html/qcop.html

Though from my understanding each app can have it's own calls (there was an app floating round a while back which listed all of the calls being made - Japanese iirc, anyone remember what it was?)

In any case you may be okay with a plain "setDocument()" call.


Si
[div align=\"right\"][a href=\"index.php?act=findpost&pid=97795\"][{POST_SNAPBACK}][/a][/div]
So it looks as if I would issue something like
Code: [Select]
qcop QPE/Application/HancomMobileWord 'setDocument(QString)' 'thisDocument.doc'in order to have HancomMobileWord launch the document I want. Since my Z is back at the office I will have to wait until Monday to play around with qcop some. Hopefully it won't take too much fiddling. That will leave me with the tiff image viewing as the only thing I need in order to have my Ruby/Qt app fully ported over from its native win32 platform. Since I installed the libtiff ipk the other day maybe looking at it closer will close that gap as well.

I can say that after experimenting with a couple of the GUI toolkits (Tk, Qt, and GTK) so far I find Qt the best fit for my needs. It's relatively object-oriented and seems to be portable enough for my needs. The fact I prefer using Ruby and am limiting my PDA choice to the Z makes this all the much better I guess...

gregarican

  • Newbie
  • *
  • Posts: 24
    • View Profile
Startup Script On Sharp 3.10 Rom
« Reply #6 on: October 01, 2005, 10:09:54 pm »
Quote
Though from my understanding each app can have it's own calls (there was an app floating round a while back which listed all of the calls being made - Japanese iirc, anyone remember what it was?)
[div align=\"right\"][{POST_SNAPBACK}][/a][/div]
Actually I found the app that you are talking about. It's here.. [a href=\"http://www2.gol.com/users/ikezawa/zaurus/qcoptest.html]http://www2.gol.com/users/ikezawa/zaurus/qcoptest.html[/url]
. I am going to give it a go Monday to see what methods I can pass along to HancomMobileWord. As much as I like to Microsoft bash, at least my Ruby/Qt app on win32 can launch the documents by just passing the document name as the first command line argument. Like
Code: [Select]
c:\program files\microsoft office\office\winword.exe myDocument.docAppreciate the help though. This should get me going.

gregarican

  • Newbie
  • *
  • Posts: 24
    • View Profile
Startup Script On Sharp 3.10 Rom
« Reply #7 on: October 03, 2005, 08:50:00 am »
As a follow-up on this, now it's first thing Monday morning here and I tried the qcop QPE/Application/HancomMobileWord 'setDocument(QString)' '/tmp/thisDocument.doc' command. Worked like a champ. Thanks for the help!

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
Startup Script On Sharp 3.10 Rom
« Reply #8 on: October 03, 2005, 10:00:53 am »
No problem, glad it worked,


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

gregarican

  • Newbie
  • *
  • Posts: 24
    • View Profile
Startup Script On Sharp 3.10 Rom
« Reply #9 on: October 03, 2005, 10:13:12 am »
Quote
No problem, glad it worked,


Si
[div align=\"right\"][a href=\"index.php?act=findpost&pid=98000\"][{POST_SNAPBACK}][/a][/div]
And as a follow up for anyone who's interested there is a tiff viewer available for the Zaurus. It's part of zfax (http://www.iaccarino.de/silvio/zfax.htm). After installing that and having a nicely sized swapfile I should be over than hurdle as well...

gregarican

  • Newbie
  • *
  • Posts: 24
    • View Profile
Startup Script On Sharp 3.10 Rom
« Reply #10 on: October 03, 2005, 12:03:05 pm »
The tiff angle still isn't too feasibile. Even with a large swapfile on my SD card I can't open the images. They are too large it seems. But I know with smaller images the tiff viewer app works.

A new problem arose using the qcop method. When I bring up the Hancom Word app with the document I want and then close Hancom Word, my Ruby/Qtopia application disappears from the screen. I do see the active process listed running the ps command, however. Is there an easy way to make it visible again? I am passing along the Ruby system() method to bring up Hancom Word. Something like:
Code: [Select]
system("qcop QPE/Application/HancomMobileWord 'setDocument(QString)' '/path/to/myDocument.doc'")This system() methods forks out a subshell and should return back to the main Ruby/Qtopia application. Although the Ruby script is still an active process the Qtopia app has disappeared. How can I bring it back?