After spending hours and hours getting Ubuntu to install on a Windows 8-optimized laptop (more on that later) I was having incredible problems getting the wireless to work. Honestly, I haven’t had problems with Linux and wireless since Ubuntu 8, but my 12.04 install just refused to recognize the Ralink RT5390R wireless card installed in my HP laptop. It’s an HP2000 laptop with a Ralink RT539B card.

Finally, after some serious searching, particularly in the Ubuntu forums, I got it working, with the help of some posts by users chili555 and ironv. If anyone else is having problems, here’s what solved it for me.

1. Download the driver from Ralink’s website. Assuming you also have the 539B card, download the RT539x PCIe package from http://www.ralinktech.com/en/04_support/support.php?sn=501

2. Unpack:

tar xvjf -filename

3. Here’s where things change. Edit ./os/linux/config.mk file to reflect the following:


HAS_WPA_SUPPLICANT=y
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y

4. Now search for NIC5392_PCIe_DEVICE_ID in all directories.

grep -r -n NIC5392_PCIe_DEVICE_ID .
./include/chip/chip_id.h:60:#define NIC5392_PCIe_DEVICE_ID 0x5392
./include/chip/rt5390.h:67:#define NIC5392_PCIe_DEVICE_ID 0x5392
./os/linux/pci_main_dev.c:75: {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC5392_PCIe_DEVICE_ID)}
./os/linux/rt_rbus_pci_drv.c:1380: (device_id == NIC5392_PCIe_DEVICE_ID)
./os/linux/rt_rbus_pci_drv.c:1669: case NIC5392_PCIe_DEVICE_ID:

Now, everywhere that turns up (see the above example) you must add an additional line, directly after it and formatted exactly the same, with NIC539B in place of NIC5392. So if you do another

grep -r -n NIC539B_PCIe_DEVICE_ID .

you’ll get:

./include/chip/chip_id.h:61:#define NIC539B_PCIe_DEVICE_ID 0x539B
./include/chip/rt5390.h:68:#define NIC539B_PCIe_DEVICE_ID 0x539B
./os/linux/pci_main_dev.c:76: {PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC539B_PCIe_DEVICE_ID)}
./os/linux/rt_rbus_pci_drv.c:1381: (device_id == NIC539B_PCIe_DEVICE_ID)
./os/linux/rt_rbus_pci_drv.c:1670: case NIC539B_PCIe_DEVICE_ID:

5. Once that’s done,

sudo make
sudo make install
sudo modprobe -r rt5390sta
sudo modprobe rt5390sta

Then reboot. Your wireless should now be working.

REMEMBER: this fix only works if you have the 539B device!! If you’re not sure, run

lspci -nn | grep 0280

That line should finish with “Device [1814:539b]”.

Good luck!

It’s a nifty little trick that can come in handy. In my case, I use it to notify me if my webserver suddenly becomes unavailable for some reason. It uses the fact that most cell phones can be texted via email by using a certain adress, such as cell#@provider.net. The code I use:

def send_text(str):

HOST = “smtp.gmail.com”

SUBJECT = “Server offline!”
TO = “xxxxxxxxxx@txt.att.net”

FROM = “python@mydomain.com”

text = str
BODY = string.join((“From: %s” % FROM, “To: %s” % TO, “Subject: %s” % SUBJECT, “”, text), “\r\n”)

s = smtplib.SMTP(‘smtp.gmail.com’,587)

s.set_debuglevel(1)

s.ehlo()

s.starttls()

s.login(“username@gmail.com”, “mypassword”)

s.sendmail(FROM, [TO], BODY)

s.quit()