Mar 14

How to fix the Nintendo AV cable brightness problem

Video signal wire

Video signal wire

I have a PAL Nintendo 64 and GameCube at home. Unfortunately their AV cables have become unusable. Looking around on eBay I bought two new ones from a seller shipping from China. They were cheap and they did their job very well… on a CRT screen.

I only started to notice the issue when I switched to an LCD TV some time ago. The brightness was really clipping and no configuration of the TV made that go away. After some Googling it turns out that the NTSC versions of the consoles have some internal components the PAL versions do not. Without modifying the AV cable you cannot fix this problem on a PAL system.

Too bad that when you’re in the market for buying a new AV cable, sellers rarely specify if it’s an AV cable meant for a PAL or NTSC console. But fret not! They only thing you need is an 100 Ohm resistor and some soldering skills.

There’s plenty of guides out there that explain you have to add capacitors as well, though I did not see any notable difference when adding those to the circuit. In fact, when I did the GameCube’s video signal didn’t get through properly to the TV while the N64 signal did. So, to keep things simple ditch the capacitor and just add the resistor.

The only thing you need to do is connect the video signal wire to the ground wire by using the resistor, anything around 80-100 Ohm is fine. Easy as that! If you’re not fond of fiddling with the cable yourself, there’s a website where you can order modified cables, you can check that out here.

Here’s a picture of the first cable that was modded, I did a second one as well where you barely see the cable was opened up, for that you should probably use SMD components as, in this case, size really matters.

Nintendo AV cable fixed

AV cable fixed

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
address 192.168.1.5
netmask 255.255.255.0
gateway 192.168.1.1
wpa-ap-scan 1
wpa-scan-ssid 1
wpa-ssid “YOUR-WIFI-NAME”
wpa-psk “YOUR-WIFI-PASSWORD”

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!

Dec 29

Traceability and requirements coverage with TestLink and Jenkins

If you’re working on a software/hardware project chances are you have a list of requirements that have to be checked off by running (automated) tests that confirm the requirement is met.

I’ve seen a lot of projects using Jenkins to automatically build and compile the software and run tests to check which existing testcases pass and which are failing with every new push to the code repository. That’s great, in the blink of an eye you see if something broke: if the number of failing testcases rises you might want to take a closer look for regression issues.

The problem with only using Jenkins is traceability.
Imagine this: you have 450 testcases, they all check a piece of the functionality of your SW/HW. If a couple of them fail, can you immediately say which requirement is not met? Unless you have a very structured way of ordering your test suites this probably is not the case. This is where TestLink comes into play.

Requirement management with TestLink

TestLink is a test and requirements management framework, completely opensource and written in PHP. It has an API which you can use even if you’re using custom or proprietary tools to execute your testcases. With said API it is very easy to return test results to TestLink automatically.

I had to deal with this kind of situation before, a whole bunch of testcases that did not link back to any requirements. That’s when I decided to expand upon the existing Jenkins configuration by adding TestLink to the mix.

A list of requirements was available which was imported into my TestLink set up. Using a quickly whipped together Python script I converted the proprietary testset XML files into something that could be imported into TestLink. A couple of minutes later I had a list of requirements and a (huge) amount of testcase entries. Manually adding requirements to each and every testcase was long and tedious work, luckily you only have to do it once. I have to admit that the TestLink user interface has been stuck in the nillies and could benefit from an overhaul but once you get used to it, it’s pretty straightforward.

Combining Jenkins and TestLink

Next up was using Jenkins to feed the results back to TestLink. The Jenkins configuration was set in such a way that a build job is spawned when a change in the repo was found. After the build job is successful a second job is spawned that executes all testsets using an in-house framework that generates jUnit XML output. To be able to match the jUnit XML files to the testcases in TestLink I used a handy Jenkins plugin.

The matching criterium is simple, using the testcase name in the “result seeking strategy” of the plugin I generated a custom field value for each testcase in TestLink which was a simplified version of the testcase name. Whenever the plugin matches this custom field value with the testcase name in the jUnit output it updates the result in TestLink.

In the build job configuration you also have to specify a build number, with the Copy Artifacts plugin I could use an environment variable that contains the Jenkins build number of the job that compiled the code. This way you can run your test job multiple times even if there is no new version of your software. TestLink will create a record for each run of a testcase so you can quickly check its health using the execution history and see the progress over time with each build number.

Conclusion

Using these tools I can quickly have TestLink generate a report that gives me an overview of the health per testsuite, how much % of the requirements have been covered and how much of that has tests that pass. It also allows you to create reports (e.g. in PDF format) to present to your project or QA manager and so much more!

To be fair, I haven’t used the full power of TestLink yet. You can manage what tests get executed for every build or milestone and have the Jenkins plugin use that info to trigger execution of those testcases. I’ve not used this functionality yet however.

It’s a first step, going from 400 testcases with no traceability to having a requirement management framework that allows you to easily follow up on requirements coverage. If you’re having trouble keeping your requirements and testcases organized I’d recommend you give TestLink a go.