Feb 11

Making the MT7601UN driver work with Raspbian

I didn’t have ethernet available at the location I wanted my Raspberry Pi to be so I opted to go for a small WiFi USB module to get connected. The one discussed in this blogpost is sold by DealExtreme as Mini 100mW 150Mbps IEEE802.11b/g/n USB WiFi Wireless Network Adapter w/Antenna. The interface comes up as “ralink0” and the company who provides the driver is called MediaTek. The actual chip is called MT7601UN.

This post sums up what errors I got, as a recap here are some things I bumped into while getting the driver to work and which I have been able to resolve:

  • “ERROR: could not insert ‘mt7601Usta’: Exec format error” while modprobing
  • “make[1]: *** No rule to make target `modules’. Stop.” while trying to compile the driver from sources
  • “wpa_supplicant: /sbin/wpa_supplicant daemon failed to start” when trying to connect to an AP
  • “/etc/network/if-up.d/secure-rmc: line 9: let: remainder = % 2: syntax error: operand expected (error token is “% 2”)
    /etc/network/if-up.d/secure-rmc: line 10: let: result = ( / 2): syntax error: operand expected (error token is “/ 2)”)” while having the interface up and running and trying to connect to an AP

Now that is out of our way, let’s take a closer look on how to get a working driver for your Raspbian version. At the time of writing I’m using using the following kernel: Linux 3.12.31 #2 PREEMPT Wed Oct 29 09:24:56 UTC 2014

Let’s look at some of the steps you need to take:

  1. Go to System Info in Kodi and check your kernel version (or ssh and use uname)
  2. Activate “Download kernel headers” in Kodi, we’ll need the Module.symvers file it’ll grab for you
  3. Go to the GitHub page for the rPi Linux kernel and choose the branch that corresponds to your kernel version. When I was trying to get things to work, I forgot about this and used master which was already at 3.18.y instead of 3.12.y and things didn’t work.
  4. While you’re cloning or downloading the Linux kernel grab the driver sources from the MediaTek website, look for MT7601U USB
  5. If you’re using 3.12.y you’ll need to fix the Kconfig file for the Kirkwood soc audio (I put the line it errors on while make’ing in comments)
  6. I couldn’t get the symlink to work that links /lib/…/build to the Linux sources we downloaded from GitHub. At least when I hardcoded the path in the driver’s makefile it worked but only then.
  7. By now your Linux download should be finished. cd into the folder and do
    1. make mrproper
    2. zcat /proc/config.gz > .config
    3. cp .config .config.org
    4. make modules_prepareNote that you’ll need to be root to do the zcat (type sudo -s to stay root)
  8. Copy over the Module.symvers file from the Linux headers folder Kodi downloaded for you
  9. Now go into the driver’s folder and type
    1. make
    2. make install
  10. If all goes well, you now have an interface for your wifi module! (if not, try rebooting)
  11. Type lsusb and see if “Bus 001 Device 007: ID 148f:7601 Ralink Technology, Corp.” pops up
  12. Type iwconfig to check if the interface is there, it’s called ra0
  13. Let’s configure the interface, create the following file /etc/udev/rules.d/70-persistent-net.rules
  14. Add the following in the file:
    1. ACTION==”add”, SUBSYSTEM==”net”, ATTR{type}==”1″, KERNEL==”ra*”, NAME = “wlan0”
  15. Open up /etc/network/interfaces (use nano or vim or whatever editor you like)
  16. Enter the following settings and edit to match with your WiFi setup (address, gateway, ssid and psk):

auto lo
iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
wpa-ap-scan 1
wpa-scan-ssid 1
wpa-ssid “YOUR-WIFI-NAME”

You could use dhcp instead of static if you’d like the rPi to have a dynamically assigned IP address however I’d like to keep it static so I know at all times what IP address I can use to reach it.

There you go, things should work now. If they don’t, feel free to leave a comment below and I’ll try to help you out.

The guides I’ve used, merged and mixed together to get it working for myself were:

Make sure you take a look at those pages for some more inspiration if you’re stuck!

Jan 04

Xperia Mini Pro First Impressions

After three years of service I said goodbye to my Nokia 3500 Classic, which was almost falling apart anyway. Time to ‘go with the flow’ and get ourselves one of them fancy Android phones I thought. Settling for compactness and not wanting to spend a whole lot of money on the device I chose the Sony Ericsson Xperia Mini Pro (Azerty version). There seems to be quite a bit of confusing posts about this phone, thank Sony for the similar naming of their phones for that. It’s the one with just one physical button (home) on the front of the phone.

So first of all, as I opened the box I noticed some thought was put into the design of the box. The phone sitting in a cradle with all other stuff (booklets, USB/socket charger and headphones) underneath.

Challenge numero uno: Getting the backcover off
As this is a brand new phone I didn’t want to break anything right from the start so I tried to take great care while doing this. The image and description in the manual didn’t speak to me as much as a Google search. The trick is to just slide your nails in between the cover and the phone when you’ve ‘clicked’ it open a bit thanks to the little plastic opening at the left side of the phone.

Secondly, using the (horrible) PC Companion I wanted to update the firmware. Windows 7 apparently couldn’t install the driver required, a quick Google search for ‘S1Boot Download Driver’ brought me to a website that had the driver available. After the manual install it worked flawlessly.

Now the phone was ready for a test drive so to speak. One thing I immediately noticed was the piles of bloatware that was added. Took some time to remove all of it, sadly not all of the apps can be removed without rooting (yes PopCap, I’m looking -angrily- at you).

I have to say, I was quite overwhelmed at first with the many options, screens and fanciness that bombarded me. I can imagine a non-tech savvy person being turned off by this (that or he just doesn’t pay attention to it at all). After spending a couple of hours checking out all the different settings and apps/widgets that I had gathered I’m quite happy with my current setup.

Switching the media player to PlayerPro, browser to Dolphin HD and the ‘launcher’ to GO Launcher EX improved quite a bit upon the default ‘skin’. I have also yet to discover the full potential of the Tasker application, which can do a ridiculous amount of customization. However, the application (app drawer) section is a complete mess when you install a handful of them. At this point I haven’t found a fast way to sort them in tidy groups of related apps (besides putting them in folders that is).

The hardware side of things is quite pleasant. The physical keyboard takes some getting used to but I prefer it to the onscreen one nonetheless. The battery is another story, having used ‘dumbphones’ for nearly 10 years with a standby time of over 5 days this is quite a disappointment. By messing around with it for a couple of hours I managed to drain the battery from 100% to less than 50%. And right now, while being used only a little bit and being idle I see the battery getting drained quite a bit (a lot less than WiFi was on though). I’m guessing a charge overnight is no excess luxury.

Using Android instead of Nokia S40 as an OS surely is a richer experience, however, at the expense of battery lifetime, but the functionality you get in return outweighs this by far.

Started using JuiceDefender, which can periodically turn on wifi for a minute to sync and turn it back off, saving a lot of battery because this way wifi doesn’t have to be on all the time when you’re not actively using the connection.

Update 2:
A few days ago I couldn’t get the phone to connect in MTP mode anymore (mass storage worked fine), for some reason Windows 7 ‘forgot’ the driver and tried reinstalling it, but that failed. I’ve Googled a bit and found the quick and easy solution to this problem:

Here is the solution. Right My Computer and select properties. Goto device manager. And locate MTP USB Device. Right click and choose select update driver. Select ‘browse my computer for drivers’ and then choose “Let me pick drivers to install”. You will get two options select the USB controllers and click OK and you are done.