Stuff I'm Working On

January 25, 2014

HP Laserjet Pro P1102w and Linux (wireless set up)

Filed under: Uncategorized — Tags: — corysohrakoff @ 22:26

So HP printer support in Linux typically excellent, and the P1102w is no exception. However, if you want to use it via wifi rather than USB you’re gonna have a bad time (unless you use Windows to perform the wireless setup, but who wants to do that?). I had hoped the hp-setup tool would be able to set up the printer’s wireless similar to the way the Windows tool does it. It has an option that seems to indicate that it could: wireless (option 3). Unfortunately, when I ran the utility it said that it could not detect a supported printer. I wasted a lot of time trying to figure out why it wasn’t working, then I found a better way.

(These instructions assume you’re using Ubuntu 12.04. If you’re not using Ubuntu you should be able to run hp-setup and it should detect your network printer after getting the wireless working.) Plug your printer into the computer. Ubuntu detects and configures it automatically as a USB printer. Next, you need this small python program: www.jspenguin.org/software/ewsgateway. Make sure python-usb and python-tk are installed on your system for this program to run. Launch the program. It will detect your printer. Select it from the list and click the start button. Afterward, click “Launch browser” to open up your printer’s web interface. Here you can configure all of the printers settings including wireless networks! When you’re done, close the webpage and click the stop button in the python program and close it. Your program should now be connected to your wireless network. You can disconnect the USB cable (and you might need to power cycle the printer for wireless to connect).

In your Ubuntu printer settings, you can delete the USB printer that was automatically configured. Then, click the add button. Expand the network printer list and you should see “HP LaserJet…” after a few moments. Select it and click forward. Accepting all of the default settings should be fine. Now, you have your wireless printer setup for Linux without having to resort to Windows.

September 13, 2011

Enabling Wifi AP Mode on a Gumstix Overo

Filed under: gumstix — Tags: , , , , — corysohrakoff @ 11:38

This guide demonstrates how to enable Wifi AP mode for a Gumstix Overo, running Linux Kerenel 3.0.3 and Ubuntu 10.04. Setting up AP mode has very little documentation, so I hope this helps to bridge the gap.

Get the required files

  1. Download the latest thin-firmware from dev.laptop.org. http://dev.laptop.org/pub/firmware/libertas/thinfirm/lbtf_sdio-9.0.7.p4.bin
  2. Rename the file sd8686tf.bin
  3. Get the required helper firmware from Marvell (SD-8686-LINUX26-SYSKT-9.70.3.p24-26409.P45-GPL) http://www.marvell.com/support/downloads/driverDownload.do?driverId=203&action=1
  4. Extract the downloaded zip file, then extract SD-8686-FEDORA26FC6-SYSKT-GPL-9.70.3.p24-26409.P45.tar within it. Navigate to the FwImage directory.
  5. Inside FwImage there is helper_sd.bin. Rename helper_sd.bin to sd8686_helper.bin and save it for later.
  6. Get the libertas_tf_sdio driver. http://dev.laptop.org/git/users/derosier/wireless-testing/
  7. Download the latest version of hostapd from: http://hostap.epitest.fi/hostapd (Dependencies: libssl-dev, libnl-dev)

Driver set-up

To get the Libertas SDIO thin-firmware driver working, you need to build the modules for your kernel. If you’re using a script to build your kernel see the note below first.

Copy the directory libertas_tf in drivers/net/wireless/ from the driver source tree into your own kernel source tree. You must patch the file drivers/net/wireless/Kconfig to include the following after the “config LIBERTAS_THINFIRM_USB” section.

config LIBERTAS_THINFIRM_SDIO
 tristate "Marvell Libertas 8686 SDIO 802.11b/g cards with thin firmware"
 depends on LIBERTAS_THINFIRM && MMC
 ---help---
 A driver for Marvell Libertas 8686 SDIO devices and those that include
 the 88W8686 core, such as the Wi2Wi devices. Special SDIO specific
 firmware is required to use this driver, see the OLPC site for details:

 <http://wiki.laptop.org/go/Thinfirm_1.5>

Prepare to build the kernel with the new modules. In menuconfig navigate to: Device Drivers—>Network device support—>Wireless LAN.

Select the following to build as modules.

  • Marvell 8xxx Libertas WLAN driver support with thin firmware
  • Marvell Libertas 8686 SDIO 802.11b/g cards with thin firmware

You should also ensure that Networking support—>Wireless—>Generic IEEE 802.11 Networking Stack (mac80211) is selected. I also took out the regular Marvell Libertas driver since I didn’t need its functionality. You may want to do the same.

NOTE: If you’re using a script to build your kernel, make sure it doesn’t replace the files you added to the source tree.

If you’re using this guide to build your kernel/filesystem. You will need to perform the following steps to get it working.

In build_kernel.sh comment out a few lines near the bottom of the file.

dl_kernel
extract_kernel
patch_kernel
#copy_defconfig
#make_menuconfig
#make_uImage
#make_modules
#make_headers

Run build_kernel.sh to do the basic set-up for you. Afterwards, change the file in the same place to look like:

#dl_kernel
#extract_kernel
#patch_kernel
copy_defconfig
make_menuconfig
make_uImage
make_modules
make_headers

Perform the driver set-up steps above and then run build_kernel again. This will build the kernel. Next, in build_deb.sh comment out a few lines near the bottom of the file.

#dl_kernel
#extract_kernel
#patch_kernel
copy_defconfig
#make_menuconfig
make_deb

Finally, run build_deb.sh

Firmware set-up

The thin-firmware and firmare helper must be placed in the /lib/firmware/ directory on the filesystem. Simply copy sd8686tf.bin and sd8686_helper.bin to /lib/firmware/ on the Gumstix filesystem.

hostapd set-up

The wireless interface cannot be manually set into AP mode, thus the hostapd software must be used. This involves natively compiling hostapd on the Gumstix Overo, so gcc and related tools are required to be installed. Cross-compilation has not been tested.

Copy the hostapd tarball to a suitable location on your Gumstix, extract it and navigate to the directory. Next, create the .config file.

$ cd hostapd
$ cp defconfig .config

Edit the file by by uncommenting the line “#CONFIG_DRIVER_NL80211=y”, i.e. removing the #. Then, build the program and then install it (as root).

$ make
# make install

Next you’ll want to set-up a configuration file for hostapd. In the directory that you just compiled hostapd, there is a sample hostapd.conf file you can use. Alternatively, here is a link to a basic hostapd.conf file that will get the wireless up and running with no encryption and the SSID set to “gumstix”. You can learn more about configuration here.

Put the .conf file somewhere that makes sense, i.e. /etc/hostapd.conf.

Loose-ends

You probably want your wireless card to be put into AP mode when the Gumstix boots. Below is an example of how to do that. (This is not the only way to do this.)

Create/edit the file /etc/network/interfaces to look like below. The wireless part is what is important so if you have some custom configuration already done in this file just edit/copy the wireless part (wlan0).

# /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet static
address 192.168.0.1
netmask 255.255.255.0
broadcast 192.168.0.255
post-up /usr/local/bin/hostapd -B /etc/hostapd.conf

The example also assigns a static IP address to the wireless card. If you don’t do this, the network won’t work. Wireless clients also must have static IP addresses assigned unless you run a DHCP server on the Gumstix to automatically assign clients IP addresses. In Ubuntu the package dhcp3-server will provide that functionality. Here is an example .conf file for a dhcp3 server.

# /etc/dhcp3/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.2 192.168.0.100;
}

With all this work done, your Gumstix should now be able to act as a Wifi access point!

The Silver is the New Black Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.