Linux Wireless AP Configuration

gw5100wireless

Configuring wireless in Linux can be complex. A very common question is how does one configure an IEEE802.11 radio as an Access Point (AP) from the command line interface (CLI). This question is difficult to answer due to evolving wireless technologies. Several tools have been created to aid in configuring these devices, but are generally not user friendly or portable across operating systems (OS).

For example, in the OpenWrt OS, the UCI System allows users to configure their wireless devices easily through the CLI. But because this tool is tightly integrated into OpenWrt, it is not easily portable to other OS’s such as Yocto or Ubuntu. Other OS’s attempt to solve wireless configuration in their own way, but fail to provide an easy solution from the serial console (e.g. using NetworkManager in Ubuntu).

Gateworks has created an open-source script called hostapd-conf that creates configuration files for the Host Access Point Daemon (hostapd), a standard Linux user space daemon that is capable of creating and managing wireless APs. Both tools are provided by default on our Yocto 1.8 BSP. The inspiration came from the simplicity of the tool wpa_passphrase, a simple CLI tool that allows for an easy way to connect to wireless APs.

The hostapd-conf script is written for users wanting to create an AP out of a radio with optional WPA2 encryption. It gathers information on a specified wireless interface through iw and uses the data to generate a proper hostapd.conf file. It has only a few dependencies to run: iw, sed, grep, and cut. It should be noted that the ‘full’ version of these tools are required as opposed to the ‘busybox’ version.

The hostapd-conf script usage is shown below:

root@ventana:~# hostapd-conf --helphostapd-conf [OPTIONS] <iface> <ssid> <channel> [<htmode>] [<passphrase>]Options: --help           - This help --br-name <name> - Name of bridge --wds <0|1>      - Enable WDS --version        - Print this version: v1.0

hostapd-conf also has the ability to list supported MCS Rates (e.g. HT20, VHT80 etc) per channel that the radio is allowed to emit radiation on. For example, the WLE350NX radio, an 802.11a/b/g/n radio, has the following channels that it may emit on:

root@ventana:~# hostapd-conf wlan0ERROR: SSID is emptyAvailable Channel Information on phy2=====================================Band 1:Channel  Freq  Allowed HT Modes0        0000  HT20 HT40 HT40+ HT40-1        2412  HT20 HT40 HT40+2        2417  HT20 HT40 HT40+3        2422  HT20 HT40 HT40+4        2427  HT20 HT40 HT40+5        2432  HT20 HT40 HT40+ HT40-6        2437  HT20 HT40 HT40+ HT40-7        2442  HT20 HT40 HT40+ HT40-8        2447  HT20 HT40 HT40+ HT40-9        2452  HT20 HT40 HT40+ HT40-10       2457  HT20 HT40 HT40-11       2462  HT20 HT40 HT40-Band 2:Channel  Freq  Allowed HT Modes0        0000  HT20 HT40 HT40+ HT40-36       5180  HT20 HT40 HT40+40       5200  HT20 HT40 HT40-44       5220  HT20 HT40 HT40+48       5240  HT20 HT40 HT40-149      5745  HT20 HT40 HT40+153      5765  HT20 HT40 HT40-157      5785  HT20 HT40 HT40+161      5805  HT20 HT40 HT40-165      5825  HT20 HT40 HT40+

From the above output, it is shown that the WLE350NX radio has two bands to select from, 2.4GHz and 5GHz. Each band offers a specific range of channels it can output on with their allowed MCS Rates, which hostapd-conf details out. Please note that the ‘0’ channel is special to hostapd. It enables Automatic Channel Selection (ACS) in order to allow the radio to pick the best channel to emit radiation on.

The following invocation of hostapd-conf will create a configuration file to output at 5.18GHz with 40MHz bandwidth, with an SSID of “wlan0-ssid” and WPA2 passphrase of “nowayinside”:

root@ventana:~# hostapd-conf wlan0 "wlan0-ssid" 36 HT40 "nowayinside"Settings: IFACE:      wlan0 PHY:        phy2 SSID:       wlan0-ssid CHANNEL:    36 FREQ:       5180 BANDS:      1 2 HWMODE:     a HTMODE:     HT40 PASSPHRASE: nowayinsideWritten to hostapd-phy2.conf

The output of the script, hostapd-phy2.conf, now holds the proper configuration required by hostapd to configure the radio to these specifications. Please take care to edit this newly created file manually if your country requires Dynamic Frequency Selection (DFS) for the channel you are emitting on. The following lines may need to be uncommented / edited:

country_code=USieee80211d=1ieee80211h=1

In an example system, four wireless radio’s were connected to a Gateworks GW5400 Single Board Computer: 1x using ath5k, 2x using ath9k, and 1x using ath10k. After following the above steps for each of the radio’s in the system, hostapd was invoked and all four radio’s were configured with different channels and technologies.

By default, hostapd will use the configuration file located at /etc/hostapd.conf. Because of this, first stop any hostapd instance that is running. Then, simply start it as a background process, for example:

root@ventana:~# /etc/init.d/hostapd stopStopping HOSTAP Daemon: stopped /usr/sbin/hostapd (pid 14876)hostapd.root@ventana:~# hostapd -B hostapd-phy0.conf hostapd-phy1.conf hostapd-phy2.conf hostapd-phy3.confConfiguration file: hostapd-phy0.confConfiguration file: hostapd-phy1.confConfiguration file: hostapd-phy2.confConfiguration file: hostapd-phy3.conf[   34.390709] IPv6: ADDRCONF(NETDEV_UP): wlan3: link is not readywlan3: interface state UNINITIALIZED->HT_SCAN[   34.409563] IPv6: ADDRCONF(NETDEV_UP): wlan2: link is not readyUsing interface wlan2 with hwaddr 00:24:2b:38:be:db and ssid "wlan2-ssid"[   34.473223] IPv6: ADDRCONF(NETDEV_CHANGE): wlan2: link becomes readywlan2: interface state UNINITIALIZED->ENABLEDwlan2: AP-ENABLED[   34.514817] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not readywlan0: interface state UNINITIALIZED->HT_SCAN[   34.542100] IPv6: ADDRCONF(NETDEV_UP): wlan1: link is not readywlan1: interface state UNINITIALIZED->HT_SCANroot@ventana:~# [   34.614847] IPv6: ADDRCONF(NETDEV_CHANGE): wlan3: link becomes ready[   34.798881] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready[   35.620978] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready

Other examples may also be found here on our Wireless wiki page. There are examples on how to create a routed AP, bridged AP, and includes other valuable information

References:

GStreamer Compositing for Streaming H.264 Video

Gateworks recently featured a blog in which 8 video cameras were connected to a Gateworks Ventana SBC and then displayed on a HDMI monitor. This is useful for localized applications. For remote applications there is another solution.

Remote applications require streaming the multiple video streams over the network (Ethernet or WiFi). For bandwidth efficiency, all camera inputs can be joined together into a single frame and then transmitted across the network.

streamingdiagram3

To join all the streams into a single frame, a software element of GStreamercalled a compositor is used. Older versions of the compositor relied on the CPU and caused choppy video. Gateworks recently started using gstreamer-imx which contains a hardware accelerated compositor which is far superior. With this compositor, each stream can be positioned on the frame and then linked to a RTSP stream in the H.264 format.

An example is shown with two Gateworks Ventana SBCs that are on the same network.

Start the following pipeline on the SBC with the cameras connected:

gst-variable-rtsp-server -u \ "imxv4l2videosrc device=/dev/video2 queue-size=55 ! queue2 ! c.sink_0 \ imxv4l2videosrc device=/dev/video3 queue-size=55 ! queue2 ! c.sink_1 \ imxv4l2videosrc device=/dev/video4 queue-size=55 ! queue2 ! c.sink_2 \ imxv4l2videosrc device=/dev/video5 queue-size=55 ! queue2 ! c.sink_3 \ imxv4l2videosrc device=/dev/video6 queue-size=55 ! queue2 ! c.sink_4 \ imxv4l2videosrc device=/dev/video7 queue-size=55 ! queue2 ! c.sink_5 \ imxv4l2videosrc device=/dev/video8 queue-size=55 ! queue2 ! c.sink_6 \ imxv4l2videosrc device=/dev/video9 queue-size=55 ! queue2 ! c.sink_7 \ imxg2dcompositor name=c background-color=0xffffff \ sink_0::xpos=0 sink_0::ypos=0 sink_0::width=320 sink_0::height=360 sink_0::fill_color=0x00000000 \ sink_1::xpos=320 sink_1::ypos=0 sink_1::width=320 sink_1::height=360 sink_1::fill_color=0x00000000 \ sink_2::xpos=640 sink_2::ypos=0 sink_2::width=320 sink_2::height=360 sink_2::fill_color=0x00000000 \ sink_3::xpos=960 sink_3::ypos=0 sink_3::width=320 sink_3::height=360 sink_3::fill_color=0x00000000 \ sink_4::xpos=0 sink_4::ypos=360 sink_4::width=320 sink_4::height=360 sink_4::fill_color=0x00000000 \ sink_5::xpos=320 sink_5::ypos=360 sink_5::width=320 sink_5::height=360 sink_5::fill_color=0x00000000 \ sink_6::xpos=640 sink_6::ypos=360 sink_6::width=320 sink_6::height=360 sink_6::fill_color=0x00000000 \ sink_7::xpos=960 sink_7::ypos=360 sink_7::width=320 sink_7::height=360 sink_7::fill_color=0x00000000 \ ! queue2 ! video/x-raw, width=1280, height=720 ! imxipuvideotransform \ ! imxvpuenc_h264 bitrate=20000 ! rtph264pay name=pay0 pt=96"

Then, on the receiving board that is connected to an HDMI display, start the following pipeline with the actual IP address (example IP below) of the board with the cameras:

gst-launch-1.0 rtspsrc location=rtsp://172.24.10.210:9099/stream latency=100 ! \queue2 ! decodebin ! autovideosink

For more information andcode examples, please visit the related Gateworks Software Wiki links below:

 

Capturing 8 Video Inputs on Gateworks Ventana SBCs

Gateworks would like to introduce software support for the AVC8000nano Mini-PCIe card on the Ventana Single Board Computers.

final_screen_camerasFigure 1: Screen capture of 8 analog cameras displayed on a monitor using the Gateworks Ventana SBC

Many applications, such as surveillance, require multipleanalog video inputs from cameras for monitoring. These cameras can then be displayed on an HDMI monitor or streamed over the network.

final_camerasonboardFigure 2: Eightanalog video cameras mounted in a circular fashion for a panoramic capture

Gateworks has added driver support for the AVC8000nano in it’s Yocto Linux board support package. This driver support will reveal 8 video interfaces in Linux, such as /dev/video0, /dev/video1, etc. These video interfaces can then be accessed using GStreamer.

final_pictureofcardFigure 3: The AVC8000nano installed on a Gateworks Ventana SBC with 8 analog cameras connected

The OpenCV software library could be used to stitch the different inputs together to create a seamless panorama.

For more information and example GStreamer pipelines on how to use this card, please visit our Software Wiki Page:

AVC8000nano Software Wiki Page

Future blog posts will cover streaming multiple camera inputs as well as adaptive bitrate streaming! Please subscribe to the Gateworks blog to the right!

 

 

Ventana Family Model Numbers & Ordering Options

The Ventana Family of Single Board Computers has been a very popular offering with the HDMI HD video input and HDMI output, the CAN Bus port and high performance i.MX6 processor along with many more great features. To provide the widest range of options, variations of each family member was created to make ordering more simple. These variations along with their part numbers are listed on our Ventana ordering options Wiki page:http://trac.gateworks.com/wiki/ventana/orderoptions