OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

3 Pages V  < 1 2 3 >  
Reply to this topicStart new topic
> Start A Network Connection From The Command Line, SL-C3100
BarrySamuels
post Mar 25 2007, 01:29 AM
Post #16





Group: Members
Posts: 103
Joined: 16-October 05
From: Maldon, Essex, England
Member No.: 8,325



QUOTE(sdjf @ Mar 25 2007, 07:50 AM)
Don't want to disappoint you, but I'm not confused at all. wink.gif

This is linux, after all, and that gives us the ability to write scripts to make things easier for us.  I think that was a great idea.


Aw shucks - you're only saying that because it's true. smile.gif

QUOTE
What command did you use to determine if the connection was up?  I've used route or ifconfig, but also sometimes use grep to check my log and make sure authentication has been completed.


The short answer's 'grep'. I'm using it for a wireless network connection and I now have at the start of my script:

Ok=0
Count=0
MaxTries=10
while (( !$Ok )) && (( $Count <= $MaxTries )); do
qcop QPE/Network 'start(QString,QString)' "/home/root/Applications/Network/modules/WLAN0.conf" ""
ifconfig | grep 'wlan' &>/dev/null
if [ $? = 0 ] ; then
Ok=1
fi
let Count=$Count+1
sleep 2
done

That seems to work.

I also have qcop QPE/Network 'stop()' at the end but I'm not sure it's working properly without some 'cardctl' commands to eject/insert the card. It stops the network Ok but the network may not restart without me ejecting and re-inserting the card (I can't remember sad.gif ). I've got to look into it more.
Go to the top of the page
 
+Quote Post
sdjf
post Mar 25 2007, 02:48 AM
Post #17





Group: Members
Posts: 454
Joined: 17-November 05
Member No.: 8,551



Oooh...that sounds very familiar. wink.gif

Don't work too hard at it...in about four weeks, after I deal with some other deadlines, I expect to be asking you to test the script I've written that resets the network applet. If it works, you should be able to simply call qreset from your script before each time you go to start a connection.

My concern has been that I only have one tty active, and don't know whether it will work properly for multiple active tty processes. I've tried asking both here and at the trolltech mailing list how to direct the 'stop' to a specific tty or pid, and gotten no answers. sad.gif From looking at the qtopia docs, it may not be officially possible. I guess it might be possible with a lot of painfully worked out tweaking of the qcop message stack to do it, to ensure that the process you want to stop is at the top.

Can you do the following for me, once with wlan active, and once when you are totally offline :

ps ax | grep tty

You may also wish to look at the page I've written at http://www.sdjf.esmartdesign.com/respawn.html about halting the respawning of ttyS0, although it may not be appropriate for your setup if you need to keep a constant connection going to a local network, like your desktop.

I also do not know which Network ttys are used for what on ROMs other than my own. My CF slot is ttyS3, and the serial i/o port is ttyS0, on my sl5500 with ROM 2.38.

Oh, yeah, I found it was a lot easier to control Network behavior by stopping that respawning, and it also speeded my Zaurus up as well.

sdjf
Go to the top of the page
 
+Quote Post
BarrySamuels
post Mar 25 2007, 03:13 AM
Post #18





Group: Members
Posts: 103
Joined: 16-October 05
From: Maldon, Essex, England
Member No.: 8,325



QUOTE(sdjf @ Mar 25 2007, 10:48 AM)
Oooh...that sounds very familiar. wink.gif

Don't work too hard at it...in about four weeks, after I deal with some other deadlines, I expect to be asking you to test the script I've written that resets the network applet.  If it works, you should be able to simply call qreset from your script before each time you go to start a connection.


Sounds good - I can wait. biggrin.gif

QUOTE
My concern has been that I only have one tty active, and don't know whether it will work properly for multiple active tty processes.  I've tried asking both here and at the trolltech mailing list how to direct the 'stop' to a specific tty or pid, and gotten no answers. sad.gif  From looking  at the qtopia docs, it may not be officially possible.  I guess it might be possible with a lot of painfully worked out tweaking of the qcop message stack to do it, to ensure that the process you want to stop is at the top.

Can you do the following for me, once with wlan active, and once when you are totally offline :

ps ax  |  grep tty


I've been totally offline for years - Oh you mean the Zaurus. cool.gif

Offline:

zaurus 4683 0.7 2.2 2020 1420 ttya0 SN 12:00 0:00 -bash
zaurus 4686 0.0 1.3 2548 844 ttya0 RN 12:02 0:00 ps aux
zaurus 4687 0.0 0.7 1304 476 ttya0 SN 12:02 0:00 grep tty

Online:

zaurus 4683 0.5 2.2 2020 1424 ttya0 SN 12:00 0:00 -bash
zaurus 5056 0.0 1.3 2548 844 ttya0 RN 12:02 0:00 ps aux
zaurus 5057 0.0 0.7 1304 476 ttya0 SN 12:02 0:00 grep tty

Is that what you wanted?
Go to the top of the page
 
+Quote Post
sdjf
post Mar 25 2007, 04:10 AM
Post #19





Group: Members
Posts: 454
Joined: 17-November 05
Member No.: 8,551



Duh, I remember hearing some ROMs use different kernel networking stuff. Um, can you grep wlan when it's active on your Zaurus? wlan doesn't use a tty? I'm baffled.

Which version of Qtopia and which ROM did you say you had?

What does your Z call the slot your CF card is in? I don't remember another command other than to grep the ps output for details, at least not after being up most of the night. wink.gif

Ah...if it's a pppd connection,

# ps auxww | grep ppp

sdjf
Go to the top of the page
 
+Quote Post
BarrySamuels
post Mar 25 2007, 04:52 AM
Post #20





Group: Members
Posts: 103
Joined: 16-October 05
From: Maldon, Essex, England
Member No.: 8,325



QUOTE(sdjf @ Mar 25 2007, 12:10 PM)
Duh, I remember hearing some ROMs use different kernel networking stuff.  Um, can you grep wlan when it's active on your Zaurus?  wlan doesn't use a tty?  I'm baffled.


Be baffled no longer. laugh.gif
zaurus 6302 0.0 0.7 1304 476 ttya0 SN 13:39 0:00 grep wlan

QUOTE
Which version of Qtopia and which ROM did you say you had?


Qtopia v1.5.4. The ROM is the standard Sharp ROM v1.01 JP.

QUOTE
What does your Z call the slot your CF card is in?  I don't remember another command other than to grep the ps output for details, at least not after being up most of the night. wink.gif


CF card is ttyS3

QUOTE
Ah...if it's a pppd connection,


It ain't
Go to the top of the page
 
+Quote Post
sdjf
post Mar 25 2007, 03:00 PM
Post #21





Group: Members
Posts: 454
Joined: 17-November 05
Member No.: 8,551



Ah! That's what I needed to know. My script could work, but I still don't know if you have ttyS0 running as well. My hunch is that you entered something other than "ps ax | grep tty" or that you weren't using the wireless when you ran the above.

That's cool. So, next time you do run that script, I'd suggest you maybe background it with an ampersand at the end of the command line, or so something to see if you have ttyS0 also running.

But can you try the "ps ax | grep pppd" and see what you get when you are not using wireless? And show the command you entered as well as it's output?

Oops...it was my mistake. I see when I run "ps aux | grep pppd" that the tty part gets cut off:

root 31707 0.0 0.5 1984 160 ttyS3 SN 15:41 0:00 /usr/sbin/pppd tt

Line was too long <:( Oh well.

Grepping for pppd should cover that...

Cheers,
sdjf

This post has been edited by sdjf: Mar 25 2007, 03:20 PM
Go to the top of the page
 
+Quote Post
sdjf
post Mar 25 2007, 04:29 PM
Post #22





Group: Members
Posts: 454
Joined: 17-November 05
Member No.: 8,551



Barry, I believe your trouble getting the card to go online the next time around is not due to using stop, but because of the qcop Network messages sent by other apps. Do you use a browser when you are connected? Or email or a chat client? Any of them can and may send their own independent messages telling qtopia when they shut down and resulting in extra stops or something getting sent later. Also, if you close your console while you are connected, that can mess things up as well for the next time around. There's nothing wrong with doing it, but it's just one of many things that can affect connections a time or two later, because of the rather whacky way our early qtopias handle network messages.

There are so many things that can interfere with connectivity that it makes more sense to me to wait until you're ready to use kismet to actually do the resetting.

If you want to see what I used to go through to get online because of what Opera 7.30 did to the GUI, see my old post at:

http://my.opera.com/community/forums/topic.dml?id=138440

But I know other apps do the stuff as well. Sometimes respawning of an unused tty can screw things up, and that's why I've been asking if you see any ttyS0 in your process listings, and if you actually use it for anything.

sdjf
Go to the top of the page
 
+Quote Post
BarrySamuels
post Mar 29 2007, 06:47 AM
Post #23





Group: Members
Posts: 103
Joined: 16-October 05
From: Maldon, Essex, England
Member No.: 8,325



QUOTE(sdjf @ Mar 25 2007, 11:00 PM)
Ah!  That's what I needed to know.  My script could work, but I still don't know if you have ttyS0 running as well.  My hunch is that you entered something other than "ps ax | grep tty" or that you weren't using the wireless when you ran the above.


Oh - no - I - didn't. :-)) Just to be sure I entered 'ps ax | grep tty' again and got the same result.

QUOTE
That's cool.  So, next time you do run that script, I'd suggest you maybe background it with an ampersand at the end of the command line, or so something to see if you have ttyS0 also running.


I ran the script normally by clicking the icon then opened a console and did the same again and got the same results. Is that sufficient?

QUOTE
But can you try the "ps ax | grep pppd" and see what you get when you are not using wireless?  And show the command you entered as well as it's output?

Oops...it was my mistake.  I see when I run "ps aux | grep pppd" that the tty part gets cut off:

root    31707  0.0  0.5  1984  160 ttyS3    SN  15:41  0:00 /usr/sbin/pppd tt

Line was too long <:(  Oh well.

Grepping for pppd should cover that...


I entered 'ps ax | grep pppd' (not using wireless) and the result was:

11087 ttya0 SN 0:00 grep pppd

QUOTE
Barry, I believe your trouble getting the card to go online the next time around is not due to using stop, but because of the qcop Network messages sent by other apps. Do you use a browser when you are connected? Or email or a chat client?


No. The script that I run is for Kismet only i.e. network scanning and is not used with anything else.
Go to the top of the page
 
+Quote Post
sdjf
post Mar 29 2007, 07:32 AM
Post #24





Group: Members
Posts: 454
Joined: 17-November 05
Member No.: 8,551



Sigh...let's try another time...

Maybe just look over the output of 'ps ax' with your eyes, and find all the lines that contain ttyS when the CF card is plugged in and shows in the taskbar. And see if there are any other tty's in addition to ttya0 that show in the list. Hopefully your eyes will pick up on whatever grep isn't fetching for us.

If your system knows the CF card is plugged in, and it's on ttyS3, then it has to show up somewhere on the list, esp. when you're running kismet.

And have you ever seen any lines showing a ttyS0 in the list? If not, that's great for my script. If yes, then it will be a good test, but I'd like to see what those ttyS0 lines look like.

sdjf
Go to the top of the page
 
+Quote Post
sdjf
post Mar 31 2007, 08:11 PM
Post #25





Group: Members
Posts: 454
Joined: 17-November 05
Member No.: 8,551



I forgot to ask. Do you have a pppd log? The resetting script works better with access to a pppd log.

On my ROM 2.38, it's in /tmp/qpe-pppd-log. Does that file exist on yours?

sdjf
Go to the top of the page
 
+Quote Post
BarrySamuels
post Apr 8 2007, 11:17 PM
Post #26





Group: Members
Posts: 103
Joined: 16-October 05
From: Maldon, Essex, England
Member No.: 8,325



QUOTE(sdjf @ Mar 29 2007, 03:32 PM)
Sigh...let's try another time...

Maybe just look over the output of 'ps ax' with your eyes, and find all the lines that contain ttyS when the CF card is plugged in and shows in the taskbar.  And see if there are any other tty's in addition to ttya0 that show in the list.  Hopefully your eyes will pick up on whatever grep isn't fetching for us.


I did 'ps ax' and the only occurrences of ttyS in the list are the ones I've already mentioned. Perhaps this version of ps ain't so good.

QUOTE
If your system knows the CF card is plugged in, and it's on ttyS3, then it has to show up somewhere on the list, esp. when you're running kismet.


I got the ttyS3 information from qpeGPS which has ttyS3 set as the Com port.

QUOTE
And have you ever seen any lines showing a ttyS0 in the list?  If not, that's great for my script.  If yes, then it will be a good test, but I'd like to see what those ttyS0 lines look like.


I suppose the answer there is no.
Go to the top of the page
 
+Quote Post
sdjf
post Apr 9 2007, 01:53 AM
Post #27





Group: Members
Posts: 454
Joined: 17-November 05
Member No.: 8,551



This might be easier to discuss in chat. I check #zaurus at irc.freenode.net for people I need to chat with, somewhere between 10pm-1am Calif time, so that'd be around 5am-8am GMT. You have a chat client?

When you do

which ps | xargs ls -l

What do you get? If you follow any symlinks and it points to busybox, then it won't be very useful output from ps.

If it is not a busybox ps, then how about pasteing in or uploading a copy of 'ps ax' from when you are online here?

Also, do you have any kind of log showing what happens when you go online/use kismet?

sdjf
Go to the top of the page
 
+Quote Post
BarrySamuels
post Apr 9 2007, 02:54 AM
Post #28





Group: Members
Posts: 103
Joined: 16-October 05
From: Maldon, Essex, England
Member No.: 8,325



QUOTE(sdjf @ Apr 9 2007, 09:53 AM)
When you do

which ps | xargs ls -l

What do you get?  If you follow any symlinks and it points to busybox, then it won't be very useful output from ps.


It points to /bin/ps

QUOTE
If it is not a busybox ps, then how about pasteing in or uploading a copy of 'ps ax' from when you are online here?


PID TTY STAT TIME COMMAND
1 ? S 0:21 init
2 ? SW 0:00 [keventd]
3 ? RWN 1:15 [kapm-idled]
4 ? SW 0:00 [off_thread]
5 ? SW 0:00 [battchrgon]
6 ? SW 0:00 [battchrgoff]
7 ? SW 0:00 [sharpsl_bat]
8 ? SWN 0:00 [ksoftirqd_CPU0]
9 ? SW 0:00 [kswapd]
10 ? SW 0:00 [bdflush]
11 ? SW 0:01 [kupdated]
12 ? SW 0:00 [rcscan]
13 ? SW 0:00 [rcenirq]
14 ? SW 0:00 [buzzer]
18 ? SW 0:00 [snd_hp]
20 ? SW 0:00 [mtdblockd]
43 ? SWN 0:20 [jffs2_gcd_mtd3]
81 ? S 0:00 /sbin/cardmgr
94 ? SW 0:00 [kjournald]
98 ? SW 0:00 [kjournald]
100 ? SW 0:00 [kjournald]
153 ? S 0:00 /sbin/sdmgr -d /dev/sd_slotstat -c /etc/sdcard/sd.con
175 ? S 0:00 /usr/sbin/inetd
185 ? S 0:00 [rpc.portmap]
195 ? S 0:00 /home/QtPalmtop/bin/atd /var/spool/at
212 ? DW 0:00 [usbh-moni]
257 ? SW 0:00 [krfcommd]
329 ? S 0:00 hcid: processing events
335 ? S 0:00 /usr/sbin/sdpd
348 ? S 0:00 /sbin/launch
349 ? S 0:01 /sbin/shsync
350 ? S 0:00 /bin/sh ./qpe.sh
374 ? SN 0:37 [qpe]
375 ? SN 0:00 [qeserver]
376 ? SN 0:08 [qeserver]
396 ? SN 0:13 launcher -qcop /tmp/qcop-msg-launcher -display Transf
655 ? SW 0:00 [kjournald]
2580 ? SN 0:02 [qkonsole]
2581 ttya0 SN 0:00 -bash
2952 ? SN 0:00 /sbin/dhcpcd -t 30 wlan0
2959 ? SWN 0:00 [rpciod]
2960 ? SW 0:00 [lockd]
2961 ttya0 RN 0:00 ps ax

QUOTE
Also, do you have any kind of log showing what happens when you go online/use kismet?


I don't think so.

The interesting thing is that the only difference in that ps listing between on-line and off-line is that

2952 ? SN 0:00 /sbin/dhcpcd -t 30 wlan0
2959 ? SWN 0:00 [rpciod]
2960 ? SW 0:00 [lockd]

appears between the two occurences of ttya0

I don't have a chat client but I do have Skype.
Go to the top of the page
 
+Quote Post
sdjf
post Apr 9 2007, 03:16 AM
Post #29





Group: Members
Posts: 454
Joined: 17-November 05
Member No.: 8,551



Oh, cool! I was just reading about dhcpcd. You are using that instead of pppd to get online.

But it doesn't seem to tell the kernel what tty it's using and that's why you couldn't find any ttyS in the ps listing. I need a way to test and make sure the resetting has been completed, and am not sure it will work as well when I can't check for the ttyS entries.

I think the next thing that would help, then, is a 'ps ax' when you can't get online, before you mess around with yanking out the card or using any cardctl commands.

I take it there is no log of dhcpcd's progress?

Look for logs in /tmp/ and in /var/log/ when you are actually online with kismet.

sdjf
Go to the top of the page
 
+Quote Post
sdjf
post Apr 11 2007, 08:19 PM
Post #30





Group: Members
Posts: 454
Joined: 17-November 05
Member No.: 8,551



Whoops! I asked for "which ps | xargs ls -l" and Barry wrote, "It points to /bin/ps."

Please paste in your results...whether you meant "shows the details for /bin/ps" or "shows a symlink pointing to /bin/ps" is not clear without me eyeballing your output. wink.gif

Also, I am wondering what the other 6 processes are that took place and are gone, between 2952 and 2959.

2952 ? SN 0:00 /sbin/dhcpcd -t 30 wlan0
2959 ? SWN 0:00 [rpciod]
2960 ? SW 0:00 [lockd]

Are they earlier, unsuccessful attempts by kermit to connect? I really need to see a "ps ax" from while kermit is searching. Try getting that by immediately entering "ps ax" right after kermit starts up. If you have trouble capturing the output, send it to a file with something like: "ps ax > kermitps".

We need to be able to study your network port's status from all angles, in order to automatically determine whether the resetting is successful or not.

I know what to check for with pppd connections, but dhcpcd is more of a challenge because it doesn't show a tty even though it uses one. sad.gif

The lack of a dhcpcd log of some sort also complicates debugging. Please snoop around the forums and web and see if you find information about dhcp or dhcpcd logs.

Another possible place to look for ttyS3 information is in the /proc file system, but I haven't found an indicator there that I think we can count on.

Whoa...I think I may have the answer..."cardctl status". Paste in four sets of output from that...one from when you are having trouble and want to yank out the card, one from after you have put it back in, and one more each from while kermit is negotiating and also once when you are finally connected. This might be what we need.

The other thing I also need to know is the name of the lock file created, if there is one. A stale lock on ttyS3 also can be the problem.

What browser(s) do you use on your Zaurus? Do you ever use them when you aren't going online?

I don't know what Skype does. If it won't let you access #bash at irc.freenode.net, you might consider getting a chat client...I recommend NeIC for the Zaurus. You also could get access through the http://www.tyrannozaurus.com gateway to #bash, or get a desktop client such as(I think) Xirc for Linux or Mirc for M$. Tyrannozaurus has links for irc client downloads..

I've turned my script topsy-turvy, adding dhcpcd stuff to it, and that's fine, but I had to rewrite the new sections a couple times as elvis kept running out of space and messing things up. I'm backing up the revisions more frequently now, as in, almost every time. wink.gif

I also saw someone somewhere on the web, suggesting killing rpciod, and you can try that when you're having problems, but I think it could create it's own problems to do it without going through qtopia and cardctl in sync with each other. They mentioned that killing rpciod releases any "stuck NFS points." Anyhow, that's another option to play with adding to my script if my model doesn't work as is.

sdjf
Go to the top of the page
 
+Quote Post

3 Pages V  < 1 2 3 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 27th November 2014 - 03:52 AM