Author Topic: Help/Hints: API for accessing WLAN card directly on Zaurus?  (Read 5895 times)

dhns

  • Hero Member
  • *****
  • Posts: 699
    • View Profile
    • http://www.goldelico.com
Help/Hints: API for accessing WLAN card directly on Zaurus?
« on: March 06, 2004, 01:31:16 pm »
I am searchin for any documentation on how to programmatically (C language) access the WLAN card to enable/disable, to read the list of networks, to select one, to specify the WEP key, to initiate an Ad-Hoc network, etc.

Now, I have found out that apparently the Zaurus uses a kernel extension to allow to access the WLAN card by a standardized way. It seems to be http://www.linux-wlan.com/linux-wlan/index.html

Is this correct? And where is the documentation of the API?

And then, there is Kismet using some ioctl calls to get/set the ESS-ID. Is there an API description available?

For the Camera, there is a PDF document from Sharp describing how to open() the decive and use read() and write() calls to set the modes and get the captured JPEGs. Is there something similar for the Zaurus?

And finally, it should be a method that is independent of the WLAN card (as long as it works with the original Sharp ROM 3.1x). Therefore, Wellenreiter does not seem to be the right starting point.

Any hints are very welcome!

--- Nikolaus hns@computer.org
SL5500G, C860, C3100, WLAN, RTM8000, Powerbook G4, and others...
http://www.handheld-linux.com
http://www.quantum-step.com

dhns

  • Hero Member
  • *****
  • Posts: 699
    • View Profile
    • http://www.goldelico.com
Help/Hints: API for accessing WLAN card directly on Zaurus?
« Reply #1 on: March 07, 2004, 05:06:41 am »
Hi all,

By looking deeper into the Kismet Sources I have found that there is a header file linux/wireless.h using ioctl() - but no clear API description.

A rather general description of the wireless kernel extension is found at http://www.hpl.hp.com/personal/Jean_Tourri...Extensions.html

-- hns
SL5500G, C860, C3100, WLAN, RTM8000, Powerbook G4, and others...
http://www.handheld-linux.com
http://www.quantum-step.com

dhns

  • Hero Member
  • *****
  • Posts: 699
    • View Profile
    • http://www.goldelico.com
Help/Hints: API for accessing WLAN card directly on Zaurus?
« Reply #2 on: March 07, 2004, 05:23:08 am »
Now, I have studied these documents and the iwconfig command (which is on the ROM 3.10) shows the card as eth0:

# iwconfig
lo        no wireless extensions.
irda0     no wireless extensions.
usbd0     no wireless extensions.
eth0      no wireless extensions.

but with my SanDisk WLAN card, it doesn\'t find a wireless extension for eth0. When I unmount the card, the eth0 disappears so the interfaces list is correct.

But the card works when being configured through Qt. Any hints about the specific system interface used by Qt?

-- hns
SL-5500G, ROM 3.10, SanDisk WLAN, Pretec 256MB, PowerBook G4
SL5500G, C860, C3100, WLAN, RTM8000, Powerbook G4, and others...
http://www.handheld-linux.com
http://www.quantum-step.com

Mickeyl

  • Hero Member
  • *****
  • Posts: 1495
    • View Profile
    • http://www.Vanille.de
Help/Hints: API for accessing WLAN card directly on Zaurus?
« Reply #3 on: March 07, 2004, 08:13:13 am »
Quote
I am searchin for any documentation on how to programmatically (C language) access the WLAN card to enable/disable, to read the list of networks, to select one, to specify the WEP key, to initiate an Ad-Hoc network, etc.
This is done via the ioctl interface. The full API reference is contained in <linux/wireless.h> - it may be a bit sparse but with experimenting and looking at the source code of the wireless tools you\'ll learn everything.
Quote
Now, I have found out that apparently the Zaurus uses a kernel extension to allow to access the WLAN card by a standardized way. It seems to be http://www.linux-wlan.com/linux-wlan/index.html
Ugh. Don\'t use wlan-ng - it uses a horribly bloated and non-standardized API. Stick with the Linux standard wireless extensions.

Quote
And then, there is Kismet using some ioctl calls to get/set the ESS-ID. Is there an API description available?
See linux/wireless.h. To set and get SSIDs use the ioctl SIOCGIWSSID and SIOGSIWSSID.

Quote
And finally, it should be a method that is independent of the WLAN card (as long as it works with the original Sharp ROM 3.1x). Therefore, Wellenreiter does not seem to be the right starting point.

To get the facts straight - the Sharp ROM is the one which is NOT using the standard. The Wellenreiter author doesn\'t support this attitude which is why you need a patched kernel for that.
Trust me, the wireless extensions _are_ the standard method for device independent wlan operations.
Cheers,

Michael 'Mickey' Lauer | Embedded Linux Freelancer | www.Vanille-Media.de
Consider donating, if you like the software I contribute to.

dhns

  • Hero Member
  • *****
  • Posts: 699
    • View Profile
    • http://www.goldelico.com
Help/Hints: API for accessing WLAN card directly on Zaurus?
« Reply #4 on: March 07, 2004, 01:04:18 pm »
Quote
See linux/wireless.h. To set and get SSIDs use the ioctl SIOCGIWSSID and SIOGSIWSSID. 

To get the facts straight - the Sharp ROM is the one which is NOT using the standard. 
Trust me, the wireless extensions _are_ the standard method for device independent wlan operations.
Many thanks!

I have looked into linux/wireless.h and created some test code but on Sharp ROM 3.10 I get

   
Code: [Select]
ioctl(SIOCGIWESSID) failed (No such device)

When running iwconfig, all devices incl. my (Sandisk) WLAN eth0 are detected as \"no wireless extension\".

So, the question remains: how is Qtopia doing that? Which system calls are they using on ROM 3.10?

-- hns
SL5500G, C860, C3100, WLAN, RTM8000, Powerbook G4, and others...
http://www.handheld-linux.com
http://www.quantum-step.com

Mickeyl

  • Hero Member
  • *****
  • Posts: 1495
    • View Profile
    • http://www.Vanille.de
Help/Hints: API for accessing WLAN card directly on Zaurus?
« Reply #5 on: March 07, 2004, 01:07:32 pm »
Qtopia does it either by calling the wlan-ng-ctl command line utility or by editing wireless.opts and ejecting+reinserting the card.
Cheers,

Michael 'Mickey' Lauer | Embedded Linux Freelancer | www.Vanille-Media.de
Consider donating, if you like the software I contribute to.

dhns

  • Hero Member
  • *****
  • Posts: 699
    • View Profile
    • http://www.goldelico.com
Help/Hints: API for accessing WLAN card directly on Zaurus?
« Reply #6 on: March 09, 2004, 03:07:01 pm »
Quote
Qtopia does it either by calling the wlan-ng-ctl command line utility
That\'s a good hint. I\'ll try to do the same. It abstracts a lot from specific system calls and might be a little more independent of ROM versions.
SL5500G, C860, C3100, WLAN, RTM8000, Powerbook G4, and others...
http://www.handheld-linux.com
http://www.quantum-step.com

dhns

  • Hero Member
  • *****
  • Posts: 699
    • View Profile
    • http://www.goldelico.com
Help/Hints: API for accessing WLAN card directly on Zaurus?
« Reply #7 on: March 10, 2004, 02:48:27 pm »
Ok, latest findings - for reference purposes (we shoud move this to the HowTo Wiki):

1. The standard Zaurus ROM 3.10 comes with two different driver models
a) wlanctl-ng (mostly for the Prism chipset cards)
 iwconfig (for others)

2. all WLAN scripts are in /home/etc/pcmcia
wlan-ng           for wlanctl-ng
wlan-ng.conf
wlan-ng.opts
wireless           for iwconfig
wireless.opts

3. /etc/wlan exists, but contains only one file (\"shared\") which appears not to be used
There are no /etc/wlan/wlancfg-ssid files

4. The WLAN card is the Interface \"eth0\"

5. The Network settings tool is /home/QtPalmtop/bin/netsetup

6. When Connecting to the network:
/sbin/cardctl is called

and

./wlan-ng start eth0

triggering ./network start eth0 and /sbin/dhcpcd eth0

7. The settings are stored by modifying the files
network.opts - BOOTP, DHCP, DNS, IP address, etc.
wlan-ng.opts - SSID, WEP-Key, ...

A scheme name is used to separate several different settings. It is the same in both .opts files.

8. When wlan-ng startup succeds, the DNS entries from network.opts are added to /etc/resolv.conf

----

So to write an applications that controls the WLAN device:

read network.opts and wlan-ng.opts to get the existing cards and drivers
let the user modify
update network.opts and wlan-ng.opts as required
call

/sbin/cardctl scheme <name-of-scheme-in-.opt-files>

-- hns
[/code]
SL5500G, C860, C3100, WLAN, RTM8000, Powerbook G4, and others...
http://www.handheld-linux.com
http://www.quantum-step.com