Note: See separate article here for help on installing this driver.I had some wireless problems yesterday, with the r8180 module seemingly missing from Ubuntu Hardy. The only source I had available was the driver from the Realtek website (revision 1027), which didn't want to compile on the 2.6.24 kernel, so I had to fix it myself first. Now that I'm back online, I discovered this project using the mac80211 framework in the new kernels, which seems to be the way forward for this driver, but I've uploaded the patch I used here in case somebody finds it useful.
I have two desktop machines, one at home in the UK and one in my apartment in Greece, and since I'm a bit short on cash right now, they have to share a hard disk - a 500Gb SATA drive in a removable caddy that I transport between the two locations. This is one advantage of linux - the exact same installed system will usually work fine on two sets of completely different hardware without modification. Even so, the hardware in my two desktops is almost identical, so I didn't give hardware much thought when I upgraded from the Ubuntu stable version (Gutsy Gibbon) to the development version (Hardy Heron) a couple of months ago back in the UK. OK, so I finally gets to my apartment in Piraeus at about 3am yesterday after two flights, a bus journey and a long walk with my suitcase (I avoid Greek taxi drivers at all cost), suffering internet withdrawal symptoms from being unplugged all day. So I switched on the router, slotted in the disk and waited for my beautiful Gnome desktop to appear. All seemed well until I went to connect to the wireless network and discovered that there was no wireless interface. This was particularly annoying since I had experienced the same problem on returning to the UK in January - the rt61 drivers in Gutsy were broken and it took me hours to get everything working properly (in the end I used the legacy SerialMonkey drivers with RUtil). But the wireless card in Greece is a Realtek 8185 chipset, and though the default Ubuntu driver used to lock up with WEP security, the driver from the Realtek website (presumably just an updated version of the same but I never bothered to investigate) had been working fine. After checking all the module blacklist files and searching for the r8180.ko driver file, I had to conclude that it had simply been removed in Hardy. Strange. But surely, all I needed to do was find the driver source and recompile it for the new kernel? Apparently not - the Realtek driver didn't want to compile for the 2.6.24 kernel, for what looked like quite a few different reasons. No doubt there was an updated driver lurking somewhere on the net, but that was a chicken-and-egg problem. I had my new Asus Eee with me so I could at least access the net, but having forgotten to bring my flash drive, I had no means of transferring anything onto the desktop machine (unless I first wanted to fix whatever was wrong with the ethernet port on the Asus, which I didn't). So I was left with two options; move the computer close enough to the router to use the ethernet cable, or fix the driver. Never having been much inclined towards physical activity (i.e. lazy) I didn't fancy moving my furniture around, much less sitting uncomfortably in the hallway all night looking for a new driver. But on the other hand, I know next to nothing about the linux kernel architecture, much less wireless technology and drivers in particular, and anyway, I hadn't touched any C code for about 10 years. But how hard could it be? Probably it just needed a couple of small fixes to get it to compile again - no debugging or stuff like that. And I am supposed to be a professional programmer after all! Well, for a change, I was right and it turned out to be easy! There were 4 basic problems: - The page member was missing from the scatterlist structure (instead it needed to use the helper function sg_set_page).
- proc_net was undeclared (now under init_net.proc_net).
- SA_SHIRQ was undeclared (needs to use IRQF_SHARED instead).
- The SET_MODULE_OWNER macro was missing (has been no-op for years and was finally removed).
I was surprised (or fortunate) that it was relatively trivial to find all the information about what had changed in the linux kernel, when, and how to update the code, albeit from multiple sources. It took me around 30 minutes to figure everything out and make the changes, which is not much more time (and in some cases much less) than it usually takes me to locate a different driver/patched sources etc.
Attachments:
rtl8185.zip | [RTL8185 driver with patch for 2.6.24 kernel.] | 692 Kb |
|