Author Topic: How To Bring Up Wlan0 Via Command-line?  (Read 8040 times)

misha

  • Newbie
  • *
  • Posts: 7
    • View Profile
How To Bring Up Wlan0 Via Command-line?
« on: August 09, 2008, 10:26:16 pm »
Hi all,

I've got a Zaurus CL-3200, using AmbiCom WL1100C-CF PCMCIA wireless card.

I'm trying to bring up wlan0 via the command-line (yeah, there's a GUI tool to do it, but I'm curious).  I can connect to the wireless AP at home (sometimes).

I see the card details in dmesg after I insert it into the slot and cardctl status lists the card at socket 0.  It's in suspended mode.  So far so good.

I'm assuming that to get the card up I need to unsuspend it.  cardctl resume prints "ioctl(): Device or resource busy", but I'm assuming that's from the built-in microdrive, which is sitting at socket 1.  cardctl resume 0 doesn't print anything and seems to succeed.  cardctl status shows the card in a suspended state, however.  Can anyone explain why this is so?

At this stage I still can't do anything wireless-related to the card as wlan0 still doesn't exist (it isn't reported by ifconfig).  Ifconfig wlan0 up prints "SIOCSIFFLAGS: No such device".

Can someone fill me in?

Cheers,
Misha

sdjf

  • Sr. Member
  • ****
  • Posts: 447
    • View Profile
    • http://www.sdjf.wordpress.com and http://www.sdjf.esmartdesign.com
How To Bring Up Wlan0 Via Command-line?
« Reply #1 on: August 11, 2008, 09:35:19 am »
Try "cardctl reset" and then "cardctl resume"

This is based on my experience with starting dialup connections from the command line.

You may want to read my webpage about this:

http://sdjf.esmartdesign.com/scripts/qreset.html

You do not mention your ROM?

sdjf
http://www.sdjf.esmartdesign.com
http://www.sdjf.wordpress.com
-----------------
sl5500 running Sharp ROM 2.38 (dead batteries)
sl6000L running Sharp ROM 1.12 (still working)
Opera 7.25 and 7.30
Socket CF 56k modem
3Com USB Ethernet Adapter
Toshiba, Lexar and Kingston SD cards
Lexar, Kingston and Transcend CF cards

sdjf

  • Sr. Member
  • ****
  • Posts: 447
    • View Profile
    • http://www.sdjf.wordpress.com and http://www.sdjf.esmartdesign.com
How To Bring Up Wlan0 Via Command-line?
« Reply #2 on: August 11, 2008, 03:44:13 pm »
You also might want to read the following thread started by someone else wanting to start a connection via the command line using wireless on a C3100:

https://www.oesf.org/forum/index.php?showtopic=21828

sdjf
http://www.sdjf.esmartdesign.com
http://www.sdjf.wordpress.com
-----------------
sl5500 running Sharp ROM 2.38 (dead batteries)
sl6000L running Sharp ROM 1.12 (still working)
Opera 7.25 and 7.30
Socket CF 56k modem
3Com USB Ethernet Adapter
Toshiba, Lexar and Kingston SD cards
Lexar, Kingston and Transcend CF cards

misha

  • Newbie
  • *
  • Posts: 7
    • View Profile
How To Bring Up Wlan0 Via Command-line?
« Reply #3 on: August 21, 2008, 10:35:48 pm »
sdjf,

Thank you for your reply.  Sorry it took me so long to follow up on it -- been rather busy with other adventures.

Unfortunately, I'm unable to tell you exactly which ROM I am using -- the device reports the version as --.-- JP.  It is some Sharp ROM, though, with a 2.4.20 kernel.  I remember flashing this ROM a while ago from a third-party rescue guide.  I can't seem to find the original "genuine" ROM from Sharp anywhere these days -- if you happen to know where I can get it, then I'd be happy to use it instead.

I've had a look at the link you suggested.  First off, qreset seems like it may be useful for me, so here is the output of the commands you ask for (at http://sdjf.esmartdesign.com/scripts/qresetinfo.html):

online (both stdout and stderr):

Code: [Select]
-rwxrwxr-x    1 root     root        89312 Jan 14  2006 /bin/ps
SL-C3200
unknown
SHARP
Processor    : XScale-PXA270 rev 7 (v5l)
BogoMIPS    : 415.33
Features    : swp half thumb fastmult edsp
CPU implementor    : 0x69
CPU architecture: 5TE
CPU variant    : 0x0
CPU part    : 0x411
CPU revision    : 7
Cache type    : undefined 5
Cache clean    : undefined 5
Cache lockdown    : undefined 5
Cache unified    : harvard
I size        : 32768
I assoc        : 32
I line length    : 32
I sets        : 32
D size        : 32768
D assoc        : 32
D line length    : 32
D sets        : 32

Hardware    : SHARP Terrier
Revision    : 0000
Serial        : 0000000000000000
2.4.20
Linux version 2.4.20 (yasui@iwamoto-del) (gcc version 2.95.2 19991024 (release)) #1 Sat, 23 Jun 2007 10:15:37 +0900
==> /var/lock/samba <==
head: /var/lock/samba: Is a directory

==> /var/lock/subsys <==
head: /var/lock/subsys: Is a directory
#local2.*                                                /dev/console
local2.*                                                /tmp/qpe-pppd-log
#local7.*                        /var/log/boot.log
15624 ttya0    SN     0:01 -bash
30738 ttya1    SN     0:01 -bash
12319 ttya1    SN     0:00 bash online.sh
12327 ttya1    RN     0:00 ps ax
12328 ttya1    SN     0:00 grep tty
-bash: /dev/ttya0
-bash: /dev/ttya0
-bash: /dev/ttya0
-bash: /dev/ttya0
-bash: /dev/ttya1
-bash: /dev/ttya1
-bash: /dev/ttya1
-bash: /dev/ttya1
bashonline.sh: /dev/ttya1

offline:

Code: [Select]
15624 ttya0    SN     0:01 -bash
30738 ttya1    SN     0:01 -bash
12813 ttya1    SN     0:00 bash offline.sh
12814 ttya1    RN     0:00 ps ax
12815 ttya1    SN     0:00 grep tty

If it looks like I might benefit from using it, I'm happy to take qreset for a test drive.

Now, for the suggested links.  While it technically does bring up the network through the command line, it does this through qcop, which isn't exactly what I was after.

I was hoping for a sequence of separate commands that would achieve the following:

1) Activate wlan0 (so that it appears in ifconfig)
2) Attempt to associate to an access point
3) Disassociate

The reason I'm after all this is I'm diagnosing a problem with the LAN card.  Sometimes it just doesn't associate.  I'm not sure where the problem is (driver, card, the actual Zaurus), but I have to go through an elaborate witch dance of yanking the card and putting it back in to get things going sometimes.  At other times it works immediately, like a charm.

Dmesg complains of frames being dropped due to them being transmitted prior to association, but this seems to happen regardless of whether or not the card eventually manages to associate successfully.

Looking forward to hearing more about qreset.

Cheers,
Misha

sdjf

  • Sr. Member
  • ****
  • Posts: 447
    • View Profile
    • http://www.sdjf.wordpress.com and http://www.sdjf.esmartdesign.com
How To Bring Up Wlan0 Via Command-line?
« Reply #4 on: August 29, 2008, 12:31:43 am »
Sorry, I am busy with other things as well.  It's been so long since I wrote the request for info that I have to go back and look.

Looks to me like I have to add a request that you include the command with it's output.  I get way way disoriented by loose output when I do not see exactly what command(s) generated it.

I can say I know zilch (nothing) about wireless, all I know is how to reset ttyS3, and possibly ttyS0.

I think it best if we take this to email or some other way for me to get your debugging stuff  as I'm not ready to do public debugging and also your output is impossible to view clearly or decipher in lynx, unless you want to post it online at the place freenode people post code, not finding it right now.

You will need others to help you with the association issue.  Also, I do not understand what your issue is with qcop.  qreset is dependant on the cardctl command, so it depends on whether the tty your wirely card uses.

If you want to use qreset to just reset ttyS3, you can start your actual connection however you want.  qreset only resets, it does NOT start a connection.

I also don't like your not knowing what ROM you are using.  How do you know it's sharp?  search here for trisoft I think they have the ROMs if you want to flash to something more know.

or google for that whole line that has yasui in it and see if that turns up what rom it is.  I'm out of lines to write on, but can't tell at this point what tty you use, and will let you research ROMs.  PM your email addie to me if you want. Browser is not best mode for me to do debugging....I found the URL for long output if you want to try it, http://pastebin.ca, altho short output here is cool for me.  What's nice about pastebin is it doesn't add html IIRC, haven't used it in a long time.

But, the problem I see is that one thing I have qreset doing is checking the /proc/ file system for a process using ttyS3, and your device doesn't show up in the system.  I don't remember how essential that is, but there has to be a way to test whether there are any processes running using the CF slot.  On my Collie ROM 2.38, it's easy...check /proc file system and output of "ps ax", but that won't work with some newer kernels.  I can't even get the tty to show in /proc/ when I'm online on my Tosa ROM 1.12 using a CF modem right this moment!

You really should contact Barry (PM him)  from the other thread...maybe his connection script would work for you from his 3100.  It won't reset, but might help with the rest of your puzzle.

Some processes just mess with the PCMCIA tty's, like Opera, some chat clients, and efax, and maybe minicom IIRC.  Do you use either/any of them?  You might watch for a correlation of when you use them and when you have to do that messy dance trying to clear your ability to connect.  

I find it annoying that the newer kernels do not display the PCMCIA tty in the proc system...haven't figured out how to find it there yet.  This runs on Tosa for me, but I don't think I've needed to reset enough to be sure it can resolve the issues as well as it does on the Collie because of that /proc/ file system issue, and because Opera on  my Tosa just doesn't do the damage there that it does on the Collie to my connectivity.

sdjf
« Last Edit: August 29, 2008, 05:05:52 am by sdjf »
http://www.sdjf.esmartdesign.com
http://www.sdjf.wordpress.com
-----------------
sl5500 running Sharp ROM 2.38 (dead batteries)
sl6000L running Sharp ROM 1.12 (still working)
Opera 7.25 and 7.30
Socket CF 56k modem
3Com USB Ethernet Adapter
Toshiba, Lexar and Kingston SD cards
Lexar, Kingston and Transcend CF cards

sdjf

  • Sr. Member
  • ****
  • Posts: 447
    • View Profile
    • http://www.sdjf.wordpress.com and http://www.sdjf.esmartdesign.com
How To Bring Up Wlan0 Via Command-line?
« Reply #5 on: August 29, 2008, 12:40:29 am »
You wrote:  cardctl
   resume 0 doesn't print anything and
   seems to succeed. cardctl status
   shows the card in a suspended state,
   however. Can anyone explain why this is so?

I think it is suspended when it needs resetting.  Haven't had to do this by hand in so long, have to research further...try this bit of code:

cardctl status| if grep suspended 2> /dev/null; then
       cardctl reset;cardctl resume; cardctl status;fi

Try that...it might help.
Also, qreset needs to know name of your lock file.  Do following:
find / -name "*LCK*" 2> /dev/null
http://www.sdjf.esmartdesign.com
http://www.sdjf.wordpress.com
-----------------
sl5500 running Sharp ROM 2.38 (dead batteries)
sl6000L running Sharp ROM 1.12 (still working)
Opera 7.25 and 7.30
Socket CF 56k modem
3Com USB Ethernet Adapter
Toshiba, Lexar and Kingston SD cards
Lexar, Kingston and Transcend CF cards

sdjf

  • Sr. Member
  • ****
  • Posts: 447
    • View Profile
    • http://www.sdjf.wordpress.com and http://www.sdjf.esmartdesign.com
How To Bring Up Wlan0 Via Command-line?
« Reply #6 on: September 01, 2008, 08:48:00 am »
Hey folks, if anyone is interested in trying qreset, while it technically will run without a log file, I won't be able to debug any problems if there is no such file.  It's like driving with blinders on.

Just because the file is there, though, doesn't mean logging is happening.  If you're online and the file has nothing in it, and it has been enabled, the system will need rebooting (a soft reset on some models) in order to get the kernel to produce the log.

If that still doesn't result in logging, then syslogd needs to be fiddled with.  I'm still learning how to work with that, and am hoping it isn't necessary.

I am working on command line options for it to possibly run on dhcpcd processes, and whatever is needed for misha to run the script successfully.  Again, qreset's home page is at

http://sdjf.esmartdesign.com/scripts/qreset.html

sdjf
http://www.sdjf.esmartdesign.com
http://www.sdjf.wordpress.com
-----------------
sl5500 running Sharp ROM 2.38 (dead batteries)
sl6000L running Sharp ROM 1.12 (still working)
Opera 7.25 and 7.30
Socket CF 56k modem
3Com USB Ethernet Adapter
Toshiba, Lexar and Kingston SD cards
Lexar, Kingston and Transcend CF cards