Aug 302012

So I’ve gotten this crazy idea into my head that I can write a script that will detect whether you have a USB WiFi dongle plugged in, whether you have the right drivers installed, and if you do, then it will ask you for WiFi details and attempt to connect. Or if you don’t have the right drivers / firmware etc, it will detect what hardware you have and install the right devices.

Now, in order to do that, I need to do some data gathering. The information that I need ?
Is this –
If you have a USB wifi adapter plugged into your Raspberry Pi, run these commands, and post the output into the comments.

Run lsusb first, to determine the Bus and Device that the USB Wifi adapter is on, and then run lsusb with the -v and -s arguments to display just the information relevant to the WiFi Adapter.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 006: ID 0c45:627b Microdia PC Camera (SN9C201 + OV7660)
Bus 004 Device 002: ID 0846:6a00 NetGear, Inc. WG111v2 54 Mbps Wireless [RealTek RTL8187L]
lsusb -v -s 004:002

If I can get enough information, then I may be able to write the script !

Thanks !

Aug 272012

I recently had some issues with the WiFi on one of my computers. The WiFi network it normally connects to was down and it wouldn’t connect to another network. This also happened on my Raspberry Pi recently, so I did something similar to get it to connect.
Using wpa_cli, I got the network to connect to make sure that all the configuration parameters were correct. I then created the configuration file that I needed for automatic connection.

To connect manually, you need to first start up wpa_cli. This assumes that wpa_supplicant is already running, which it should be in most cases. If it’s not, you will see an error when you start wpa_cli.

Otherwise, once you’re in wpa_cli, it will show a prompt similar to this

Selected interface 'wlan0'

Interactive mode


Using the scan and scan_results command, you can scan for the networks and see some basic information

> scan
> scan_results
bssid / frequency / signal level / flags / ssid
00:55:ab:25:ac:5a 2462 -71 [WPA2-PSK-CCMP][ESS] WLAN-Network
00:11:99:51:ba:f0 2437 -64 [WPA2-PSK-CCMP][ESS] WLAN-Network2

In the above scan results, you can see the 2 networks that the computer can pick up, the frequencies / channel that they are broadcasting on, the signal strength, the security type, and network name. Both of these networks are using WPA2 with a Pre-Shared Key.

To connect to one of them, we need to first create a network.

> add_network

This will output a number, which is the network ID.

> add_network

This will create an empty network ready for us to configure it.
Next up, we need to set the SSID and PSK for the network.

set_network 0 ssid "WLAN-Network"
set_network 0 psk "SupahSecretPassphrase"

Once these parameters are entered, wpa_cli should show the client trying to connect straight away.
When it tries to connect, it should show something like this

> <2>Trying to authenticate with 00:55:ab:25:ac:5a (SSID='WLAN-Network' freq=2437 MHz)
> <2>Trying to associate with 00:55:ab:25:ac:5a (SSID='WLAN-Network' freq=2437 MHz)
> <2>Associated with 00:55:ab:25:ac:5a
> <2>WPA: Key negotiation completed with 00:55:ab:25:ac:5a [PTK=CCMP GTK=CCMP]
> <2>CTRL-EVENT-CONNECTED - Connection to 00:55:ab:25:ac:5a completed (reauth) [id=0 id_str=]

Once the wireless has connected, it should automatically get an IP address.
If it doesn’t you can run the dhclient command to force it to get an IP address via DHCP, or edit /etc/network/interfaces to set a static IP address for the wireless network interface.

Hopefully this helps someone out there !

Aug 272012

** UPDATE **
A new version of RSE has been released.
Grab it here

I’ve just did a small update to Raspbian Server Edition.

Changes –
Updated raspi-config
Raspbian Server Edition is now at the top.
Network configuration has been simplified.
sudo has been reinstalled.

Very slow progress at the moment, but I’m adding features on slowly.

Please, check it out and feel free to send me any feedback.

RSE v2.1 can be downloaded from
Here (ad supported)

Aug 212012

*Update* Version 2.1 is out

Hey Everyone.

I’ve updated Raspbian Server Edition. Cut down the size of the download by a lot thanks to some suggestions on the forums.
I’ve also updated raspi-config with some options for RSE. I will add more as I think of them, but for now that’s all the changes.

You can get RSEv2 from –
Here (ad supported)

Any feedback will be very welcome.
Thanks !

Aug 182012

Following on from the previous webcam posts, I decided to see if the Pi has enough grunt to stream 2 webcams at once.
The USB driver for the Pi at the moment isn’t quite up to the task at the moment, but I can get the 2 streaming at low resolutions for hours at a time at the moment.

I am still using the original ffmpeg that I compiled back from the first post.
I modified the ffserver.conf so that it would accept 2 streams of input rather than just one.

The following stanza is duplicated

<feed webcam.ffm>
file /tmp/webcam.ffm
FileMaxSize 20M

Like so – I added the number to the end to identify which webcam was which.

<Feed webcam0.ffm>
file /tmp/webcam0.ffm
FileMaxSize 20M

<Feed webcam1.ffm>
file /tmp/webcam1.ffm
FileMaxSize 20M

Then, the Stream stanzas are also duplicated.
These will be the addresses that are accessed to view the stream.
This is also where the bitrate, framerate and quality settings are defined.

<Stream webcam0.mjpeg>
Feed webcam0.ffm
Format mjpeg
VideoSize 320x240
VideoFrameRate 4
VideoBitRate 10000
VideoQMin 1
VideoQMax 10

<Stream webcam1.mjpeg>
Feed webcam1.ffm
Format mjpeg
VideoSize 320x240
VideoFrameRate 4
VideoBitRate 10000
VideoQMin 1
VideoQMax 10

After the ffserver.conf file is modified, ffmpeg will need to be run twice. Once for each webcam.
The command is the same, except for changing the input file at the end.

ffmpeg -loglevel info -r 4 -s 160x120 -f video4linux2 -i /dev/video0 http://localhost/webcam0.ffm
ffmpeg -loglevel info -r 4 -s 160x120 -f video4linux2 -i /dev/video1 http://localhost/webcam1.ffm

Running those 2 commands will then start streaming both webcams into ffserver, which will in turn make the streams accessible via a web browser.