Extra WiFi Information for Lejos

A place to discus the development of leJOS for the EV3. Please do not use this section to post questions about how to use leJOS or to report problems etc.
New User
Posts: 2
Joined: Sun Mar 08, 2015 7:52 pm

Extra WiFi Information for Lejos

Postby simplexr » Sun Mar 08, 2015 8:03 pm

I'm trying to get additional WiFi information for the various access points from Lejos. Specifically, I'd like to get at least the quality of the signal, but the frequency would be nice, too.

It seems at though the Linux Lejos uses doesn't include iw/iwlist, which would give me what I wanted. So I figure I have two options:

  • Find a way to compile the iwlist tools into an valid bash program, and put that on the EV3 brick.
  • Try to use ioctl to access the info I need through JNA.

I don't even know where to begin with the first one, and since I'm on a windows box, it seems like it might fairly difficult (build a cross compile toolchain to ARM, get the right settings for the EV3 brick, compile, etc.).

So I've tried a bit with the second. But I'm having the hardest time figuring out the ioctl interface for wireless. I've looked at the Linux wireless.h file, and have a rough idea of the structures and how to define those using JNA, but I can't figure out the format for the ioctl calls that need to pass additional information (namely: get information about access point X, where X is not the one I'm currently connected to).

Anyway, does anyone have any hints as to what I could do to make this work for me? If there is an easy way to get compiled versions of iwlist, I'd use that and just parse the result. All of this stuff seems fairly opaque and I don't understand how anybody figures it out in the first place.

User avatar
leJOS Team Member
Posts: 6001
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Extra WiFi Information for Lejos

Postby gloomyandy » Sun Mar 08, 2015 8:56 pm

Well here is the source of iwlist, which shows you how to obtain and process the scan results:
http://sourcecodebrowser.com/wireless-t ... ource.html
Here is the existing code from leJOS which performs a scan and returns just a list of access points:
https://sourceforge.net/p/lejos/ev3/cod ... e.java#l21

So essentially all you need to do(!) is to extend the second using information from the first to return whatever it is you need....

Good luck!

New User
Posts: 2
Joined: Sun Mar 08, 2015 7:52 pm

Re: Extra WiFi Information for Lejos

Postby simplexr » Mon Mar 09, 2015 4:28 pm

Let me give you an update.

Figuring out what iwlist is doing is about as clear as mud, and I was just not making any headway with regards to that.

So I tried grabbing some armv5 compiled binaries of wireless-tools and iw. I basically grabbed rpm packages and put the contents into Lejos. After getting the permissions and dependencies worked out, I finally got the programs to run, but they didn't seem to be working correctly. Specifically, I couldn't get them to scan the network - iwlist would do a scan but then would report back a message:

Failed to read scan data : Resource temporarily unavailable

Googling showed many reasons why this could occur, but none of them helped me. In the end, I just gave up. It could have been a permission issue, or a setting for the wireless dongle (Netgear Wireless-N 150), or maybe issues with the compiled binaries. I already spent a bunch of time on this making barely any progress, so gave up here as well.

It turns out that there is another utility that is in Lejos which will do what I want: wpa_cli. I can get signal strength, frequency, and the ssid of the access point. I would have liked to get one of the other solutions working (especially having Java access the information directly rather than through a command line call), but at least I have something.

Return to “leJOS EV3 Development”

Who is online

Users browsing this forum: No registered users and 2 guests