Thursday, 17 May 2012

Patching the ar5523 driver

I made further progress with building a driver for my WG111T USB wifi. This is the latest incantation that I am using:

svn co svn://svn.berlios.de/fullstory/ar5523/trunk ar5523
wget http://verein.lst.de/~hch/ar5523.tgz
tar -xf ar5523.tgz ar5523/uath-ar5523.bin --strip 1
cd ar5523
QUILT_PATCHES="debian/patches" quilt delete kcompat-2.6.34
QUILT_PATCHES="debian/patches" quilt new usbfix
QUILT_PATCHES="debian/patches" quilt add ar5523.c

... edit ar5523.c as per the diff below ...

QUILT_PATCHES="debian/patches" quilt refresh
dpkg-buildpackage -us -uc
sudo dpkg -i ../ar5523-source*deb
sudo m-a a-i ar5523


Here are the diffs of the fixes which I had to make. A couple of USB functions have changed name and a networking structure has changed a bit:

Index: ar5523/ar5523.c
===================================================================
--- ar5523.orig/ar5523.c 2012-05-17 22:59:30.741403331 +0100
+++ ar5523/ar5523.c 2012-05-17 23:01:02.500427071 +0100
@@ -886,7 +886,7 @@
}

static int ar5523_add_interface(struct ieee80211_hw *hw,
- struct ieee80211_if_init_conf *conf)
+ struct ieee80211_vif *conf)
{
struct ar5523 *ar = hw->priv;

@@ -1122,7 +1122,7 @@
struct ar5523_tx_cmd *cmd = &ar->tx_cmd[i];

usb_kill_urb(cmd->urb);
- usb_buffer_free(ar->dev, AR5523_MAX_TXCMDSZ,
+ usb_free_coherent(ar->dev, AR5523_MAX_TXCMDSZ,
cmd->buf, cmd->urb->transfer_dma);
usb_free_urb(cmd->urb);
}
@@ -1142,7 +1142,7 @@
ar5523_err(ar, "could not allocate tx urb");
goto out;
}
- cmd->buf = usb_buffer_alloc(ar->dev, AR5523_MAX_TXCMDSZ,
+ cmd->buf = usb_alloc_coherent(ar->dev, AR5523_MAX_TXCMDSZ,
GFP_KERNEL,
&cmd->urb->transfer_dma);
if (!cmd->buf) {
@@ -1159,7 +1159,7 @@
while (--i >= 0) {
struct ar5523_tx_cmd *cmd = &ar->tx_cmd[i];

- usb_buffer_free(ar->dev, AR5523_MAX_TXCMDSZ,
+ usb_free_coherent(ar->dev, AR5523_MAX_TXCMDSZ,
cmd->buf, cmd->urb->transfer_dma);
usb_free_urb(cmd->urb);
}
@@ -1175,7 +1175,7 @@
struct ar5523_rx_cmd *cmd = &ar->rx_cmd[i];

usb_kill_urb(cmd->urb);
- usb_buffer_free(ar->dev, AR5523_MAX_RXCMDSZ,
+ usb_free_coherent(ar->dev, AR5523_MAX_RXCMDSZ,
cmd->buf, cmd->urb->transfer_dma);
usb_free_urb(cmd->urb);
}
@@ -1195,7 +1195,7 @@
ar5523_err(ar, "could not allocate rx urb");
goto out;
}
- cmd->buf = usb_buffer_alloc(ar->dev, AR5523_MAX_TXCMDSZ,
+ cmd->buf = usb_alloc_coherent(ar->dev, AR5523_MAX_TXCMDSZ,
GFP_KERNEL,
&cmd->urb->transfer_dma);
if (!cmd->buf) {
@@ -1213,7 +1213,7 @@
if (error) {
ar5523_err(ar, "error %d when submitting rx urb",
error);
- usb_buffer_free(ar->dev, AR5523_MAX_RXCMDSZ,
+ usb_free_coherent(ar->dev, AR5523_MAX_RXCMDSZ,
cmd->buf, cmd->urb->transfer_dma);
usb_free_urb(cmd->urb);
return error;
@@ -1228,7 +1228,7 @@

usb_kill_urb(cmd->urb);

- usb_buffer_free(ar->dev, AR5523_MAX_RXCMDSZ,
+ usb_free_coherent(ar->dev, AR5523_MAX_RXCMDSZ,
cmd->buf, cmd->urb->transfer_dma);
usb_free_urb(cmd->urb);
}

With this patch in place I can now build the ar5523 module but I can't install it because of the following error:

Done!
unpack
Extracting the package tarball, /usr/src/ar5523.tar.bz2, please wait...
"/usr/share/modass/packages/default.sh" build KVERS=3.1.9+ KSRC=/usr/src/linux-OLDVERSION.1337203974 kdist_image
Done with /lib/modules/3.1.9+/ar5523-modules-3.1.9+_0~slh.12_armel.deb .
dpkg -Ei /lib/modules/3.1.9+/ar5523-modules-3.1.9+_0~slh.12_armel.deb
Selecting previously deselected package ar5523-modules-3.1.9+.
(Reading database ... 48573 files and directories currently installed.)
Unpacking ar5523-modules-3.1.9+ (from .../ar5523-modules-3.1.9+_0~slh.12_armel.deb) ...
dpkg: dependency problems prevent configuration of ar5523-modules-3.1.9+:
ar5523-modules-3.1.9+ depends on linux-image-3.1.9+; however:
Package linux-image-3.1.9+ is not installed.
dpkg: error processing ar5523-modules-3.1.9+ (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
ar5523-modules-3.1.9+

I: Direct installation failed, trying to post-install the dependencies

apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
ar5523-modules-3.1.9+
0 upgraded, 0 newly installed, 1 to remove and 29 not upgraded.
1 not fully installed or removed.
After this operation, 81.9 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 48579 files and directories currently installed.)
Removing ar5523-modules-3.1.9+ ...

Clearly the next challenge is to get a linux-image-3.1.9+ package installed.

 

No comments:

Post a Comment