Tuesday, 28 July 2009

Artec DVB USB in Linux

So I unboxed my Artec TV tuner card, now I have to get it working!

You need firmware and kernel modules. You can download the firmware for it here:

Use wget or some way of getting it. Then move the file to /lib/firmware.

You also need the v4l-dvb kernel drivers (compatible with kernel 2.6.16 and up). In Gentoo, emerge media-tv/v4l-dvb-hg. Other distributions have instructions here.

Now insert the card. udev will handle loading the correct modules. My syslog output looks like this:
usb 1-3: Product: ART7070
usb 1-3: Manufacturer: Ultima
usb 1-3: SerialNumber: 001
usb 1-3: configuration #1 chosen from 1 choice
dvb-usb: found a 'Artec T14BR DVB-T' in cold state, will try to load a firmware
usb 1-3: firmware: requesting dvb-usb-dib0700-1.20.fw
dvb-usb: downloading firmware from file 'dvb-usb-dib0700-1.20.fw'
dib0700: firmware started successfully.
dvb-usb: found a 'Artec T14BR DVB-T' in warm state.
dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
DVB: registering new adapter (Artec T14BR DVB-T)
DVB: registering adapter 0 frontend 0 (DiBcom 7000PC)...
DiB0070: successfully identified
input: IR-receiver inside an USB DVB receiver as /class/input/input7
dvb-usb: schedule remote query interval to 50 msecs.
dvb-usb: Artec T14BR DVB-T successfully initialized and connected.
Look for a line similar to dib0700: firmware started successfully. If you see Cannot find firmware file then make sure you downloaded the firmware properly, and check your system's firmware directory. Also check the firmware file name, as it might want a slightly different firmware file.

That's it! From there I plugged in an antenna, loaded MythTV, and watched some HD TV!

SynCE 0.14 in Gentoo

I just tested app-pda/synce-gvfs-0.3 in Gentoo with gnome-base/gvfs-1.2.3. This is the first ebuild for the SynCE 0.14 release (announcement here), and it's available in the SynCE overlay.

synce-gvfs works without upgrading other SynCE components to 0.14. For me, it fixes a gvfs crash when trying to copy files off your device.

Comments welcome :) The rest of SynCE 0.14 will happen eventually :)

Artec USB DVB-T tuner card

I just purchased the Artec T14BR HD DVB-T TV tuner dongle for turning my old laptop into a MythTV box. It cost $46.90 including GST and postage from Deals Direct.

I now have a High Def set top box, with 80Gb hard drive for (essentially) $46.90. And if I want to make it a twin tuner HD STB, it's just another $46.90.

Here is the picture of the box:

And here are all the contents (note, no aerial, but I knew that):

And finally a close up of the interesting stuff:

The dongle has a window on either side, presumable for the IR reciever in the middle somewhere.

Support for Linux is supposedly good (stay tuned, haha!). lsusb identifies it as "Bus 001 Device 025: ID 05d8:810f Ultima Electronics Corp." The syslog output when I plug it in looks like this:
usb 1-3: new high speed USB device using ehci_hcd and address 25
usb 1-3: New USB device found, idVendor=05d8, idProduct=810f
usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-3: Product: ART7070
usb 1-3: Manufacturer: Ultima
usb 1-3: SerialNumber: 001
usb 1-3: configuration #1 chosen from 1 choice
This isn't "the" laptop, so I don't have any drivers installed for it, hence that's all for now.

I'll let you know how it works in my next post.

Monday, 13 July 2009

Hey you! Follow my Blog! (please?)

A huge thanks to the many visitors to my blog each month. I've made a few changes to my blog to make it a bit more interactive.

Now you can "follow" this blog and see an image cloud of other followers. Just click on the "Follow" button to the right.

Also, I've added "reactions" below each post. They're easier than comments, and it offers a way to give me some quick feedback (like "cool", or "shut up!").

So please try it out, For Great Justice. (or not, it's up to you :)

Saturday, 11 July 2009

Broadcom BCM4306 wireless LAN without ndiswrapper

I've been updating an old laptop as you might have read.

Last night I tried to start the wireless LAN, but too many kernel upgrades had obsoleted my setup! When I first got the laptop around 2004, ndiswrapper was the only option. By now I thought there must be a better way! I settled on the b43legacy drivers. Many thanks to that great site for all the specific details.

As I write, I'm using the wireless LAN with b43legacy without problems!

But how? I'll show you the details for the specific WLAN controller in the Dell Inspiron 9100.

According to wireless.kernel.org (wko)
If your card is a BCM4306 Rev 2, or only has 802.11b capability, it uses b43legacy. All other models use b43.
As you can see, I have revision 2, so I have to use the b43legacy driver. To identify your card, type `lspci -vnn | grep 14e4`. This is my response:

Subsystem: Broadcom Corporation Device [14e4:4d64]
02:00.0 Ethernet controller [0200]: Broadcom Corporation BCM4401 100Base-T [14e4:4401] (rev 01)
02:03.0 Network controller [0280]: Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller [14e4:4320] (rev 02)
The 14e4 is necessary to use any b43 driver.

At wko, b43legacy is specified for revision 2, and b43 for revision 3.
Supported chip types
* bcm4306 (Rev. 2 uses b43legacy, Rev. 3 uses b43)
Now to configure your kernel. (This may be done for you). Check these options are set:
  • Networking support > wireless
  • Generic IEEE 802.11 Networking Stack (mac80211)
  • Enable LED triggers (MAC80211_LEDS) (if you have LEDs)
Also enable:
  • Network device support > wireless LAN
and the following options:

Now make, install, and reboot! The module b43_legacy was loaded automatically for my by udev.

I use wpa_supplicant to connect. Your config files may vary. Somehow you need to specify that wpa_supplicant should be started like this:
wpa_supplicant -iwlan0 -Dwext -c/etc/wpa_supplement.conf

In gentoo, edit /etc/conf.d/net:

There's one final step. The BCM cards need firmware which is loaded by the proprietary windows drivers. You must download this in addition to a firware cutter called b43-fwcutter. In Gentoo, emerge b43-fwcutter. Then run these commands (thanks again to wko).
export FIRMWARE_INSTALL_DIR="/lib/firmware"
wget http://downloads.openwrt.org/sources/wl_apsta-
sudo b43-fwcutter -w "$FIRMWARE_INSTALL_DIR" wl_apsta-
The output looks like this:
This file is recognised as:
ID : FW10
filename : wl_apsta.o
version : 295.14
MD5 : e08665c5c5b66beb9c3b2dd54aa80cb3
Extracting b43legacy/ucode2.fw
Extracting b43legacy/ucode4.fw
Extracting b43legacy/ucode5.fw
Extracting b43legacy/ucode11.fw
Extracting b43legacy/pcm4.fw
Extracting b43legacy/pcm5.fw
Extracting b43legacy/a0g0bsinitvals2.fw
Extracting b43legacy/b0g0bsinitvals5.fw
Extracting b43legacy/a0g0initvals5.fw
Extracting b43legacy/a0g1bsinitvals5.fw
Extracting b43legacy/a0g0initvals2.fw
Extracting b43legacy/a0g1initvals5.fw
Extracting b43legacy/b0g0bsinitvals2.fw
Extracting b43legacy/b0g0initvals5.fw
Extracting b43legacy/b0g0initvals2.fw
Extracting b43legacy/a0g0bsinitvals5.fw

You may need to specify a different firmware directory. /lib/firmware is correct for Gentoo.

Now you should be able to start your network script. In Gentoo /etc/init.d/net.wlan0 start. syslog shows:

b43legacy-phy0: Loading firmware version 0x127, patch level 14 (2005-04-18 02:36:27)
b43legacy-phy0 debug: Chip initialized
b43legacy-phy0 debug: 30-bit DMA initialized
Registered led device: b43legacy-phy0:tx
Registered led device: b43legacy-phy0:rx
b43legacy-phy0 debug: Wireless interface started
b43legacy-phy0 debug: Adding Interface type 2
b43legacy-phy0 debug: Radio initialized
b43legacy-phy0: Radio turned off by software
b43legacy-phy0: Radio turned on by software
/etc/init.d/net.wlan0[12885]: WARNING: net.wlan0 has started, but is inactive
wlan0: direct probe to AP --:--:--:--:--:-- try 1
wlan0 direct probe responded
wlan0: authenticate with AP --:--:--:--:--:--
wlan0: authenticated
wlan0: associate with AP --:--:--:--:--:--
wlan0: RX AssocResp from --:--:--:--:--:-- (capab=0x431 status=0 aid=2)
wlan0: associated
wpa_cli: interface wlan0 CONNECTED
dhcpcd[13080]: wlan0: dhcpcd 4.0.13 starting
dhcpcd[13080]: wlan0: broadcasting for a lease
dhcpcd[13080]: wlan0: offered x.x.x.148 from x.x.x.1
dhcpcd[13080]: wlan0: acknowledged x.x.x.148 from x.x.x.1
dhcpcd[13080]: wlan0: checking x.x.x.148 is available on attached networks
dhcpcd[13080]: wlan0: leased x.x.x.148 for 604800 seconds
I removed IP addresses, hostnames, and MAC addresses.

And that's it! Let me know how you go, especially if you have an Inspiron 9100. If not, be sure to check out the official site for more details: http://wireless.kernel.org/en/users/Drivers/b43

Friday, 10 July 2009

Dell Inspiron 9100 Internals part 3: CPU cooling assembly

After removing the video card, the next step was to access the CPU fan. In the picture on the right you can see the Microprocessor Thermal-Cooling Assembly starting with the CPU fan at the bottom middle, running over the northbridge copper heat transfer pipe, and finally to the CPU heatsink. This Aluminium block has two copper pipes running to the left and right fans, for extra cooling.

Once I had got this far, I suspected the blockage was after the fan, but before the Aluminium block. I removed the video card (as you saw previously) and then the four screws on the block.

The block gave a bit of resistance, and then lifted. Experts would recommend you do this to a hot machine, and this is the reason why: There's the CPU nicely stuck to the block. oops! The CPU pulled right out of the closed ZIF socket! Note that you can't do this to a warm laptop, unless you're fast, as it takes time to get this far.

There's a great thread here about removing a stuck CPU. I think the dental floss is a bit over the top (and time consuming), so I used a heat gun. I placed the assembly upside-down so the CPU wouldn't fall off, and blew the heat gun (or hair dryer) on the two end fins. Stop when it's only just too hot to touch. Then only a tiny bit of pressure was required to lift the CPU. Don't apply pressure to the corner of the CPU with a screwdriver!

Here's the final shot showing no CPU or video card.
Make sure you cover the ZIF socket
with something to keep it dust free. And don't touch the CPU or heat sink heat transfer surface, as your skin-oils can deter the heat transfer.

Here's the cooling assembly. You can see the thick dust covering the channel. There was also dust all through the fins. (Again, sorry for the bad photos).

Now I cleaned the CPU surface and heat sink surface with alcohol and a lint-free cloth, and applied a covering of Arctic Silver. The next two photos show why it needed cleaning:

And now it's time to reinstall! Follow the pull-apart instructions backwards.

Take careful note of where the screws go as some screws were different sizes to the ones listed in the Dell guide. Also make sure you take care with re-inserting the parts. I cracked the display bezel and one hinge because I couldn't fit the centre hinge cover properly. Nevermind, they're only about US$25!

On the right you can see a gcc compile at 100% CPU usage. The CPU has only just started to heat up at 43 degrees C. It didn't pass 58 degrees after compiling my system for hours, and the fans were all at low / medium speed.

Finally, at idle, it's now 40 degrees C. (woot).

Oh, and by the way: I suspended before taking out the CPU, and I resumed days later without any software issues!

Dell Inspiron 9100 Internals part 2: Video card

Part 1 of pulling-apart my laptop is here.

In this part I'm showing pictures of the video card before and after removal.

Here is the exposed shot again:
At the top left you can see two sets of cooling fins with a copper pipe running diagonally to a daughter board. This board is my ATI Mobility Radeon 9700 M10 with 64Mb RAM (woohoo!). Other options are the Mobility 9700 with 128Mb RAM, and the Mobility 9800. (I wish I had the 9800...)

Below the heat sinks on the far left is a fan. One heat sink transfers heat from the video card (furtherest back) via the copper pipe you can see. The other heat sink transfers heat from the CPU via a copper pipe that runs under the video card. You can just see it running parallel to the back edge.

Follow the Dell instructions for removing the video card (and my disclaimer) in Post 1. It looks like this:
You can see the copper transfer pipe, and the cooling fins. Copper is excellent at transferring heat! You'll see why in Part 3.

The next photo shows what the system board looks like without the video card!
You can now clearly see the CPU heat transfer pipe, as well as a third copper pipe under the video card. The third pipe looks like its attached to the northbridge heat sink. This third pipe runs diagonally to the CPU cooler, and ends in a small aluminium heat transfer block under the black plastic cover you can see.

The video card slot is visible next the the fan. Kudos to Dell and other laptop manufacturers for making laptops almost as modular as desktops, however replacement video cards are hundreds of dollars! I can't find any cheap second hand parts. If you can, let me know!

Dell Inspiron 9100 Internals part 1: accessing the components

So I've had my Inspiron 9100 since 2003 or 2004 - when they were quite new. Back then the 3.0GHz P4 was a super machine, and even now it beats most light laptops with boot-up time and performance.

Lately it's been under a desk as a remote server, so I haven't seen much of it. I pulled it out recently and noticed the fans were spinning quite a lot, and the CPU temp was quite high - 60 - 70 degrees.

I pulled out the two side ventilators (fans) and cleaned a large amount of fine dust from the fans and heat sink fins. This has massively reduced the fan usage, and the CPU temperature is now down to 40 degrees at idle.

However there's one more fan - the CPU fan - that I couldn't easily reach. I could hear it all the time so I assume its suffering from the same problem: dust. I finally decided to pull it apart and clean it, and here is my progress. This is also an interesting look into how a Dell laptop wears over time - not too bad in my opinion.

First, CONTINUE AT YOUR OWN RISK! The pull-apart starts easy and low risk, but as soon as you pull apart the display assembly, video card and CPU you're in the high-risk area. If you break your laptop, you can keep the change from selling the parts on eBay!

Second, follow the instructions from Dell - they're the ultimate pull-apart guide and I only found them lacking at the very last stage (CPU fan removal).

Here's a grainy shot of the left hinge cover - there's plenty of dust there. (sorry about the bad quality - it's my phone camera). See the dust near the display attachment:

Now I've taken off the keyboard and surrounds. There's more dust:

Here is a shot of the laptop from the top as you would sit at it to work, but without the display, keyboard, touchpad, etc. The CPU fan is at the bottom centre.

Here is just half of the screws I removed (I count 30 so far). Next to them is the hinge covers:

This got me to some of the system board components. In the next post I'll show the removed video card, CPU and heatsinks.


Friday, 3 July 2009

The Twouble with Tcl

From time to time I do a bit of tcl. Mostly as maintenance for existing tcl programs. I haven't made up my mind entirely about it yet - I've seen some very powerful programs in tcl, and yet occasionally I'm still "surprised" by a feature.

I spent a couple of hours today trying to figure out why a tcl program of mine wasn't running, and so I've made some notes:

Real languages don't have reserved words

In tcl, you can redifine parts of the language in tcl itself. For example if you wanted to redefine if, just write a new function:
proc if {cond expres} {
puts "cond is $cond"
puts "expr is $expres"

set a 1
if {$a == 1} {
puts hello
Sounds neat. In fact proc itself is just a command that takes 3 arguements (name, arguements, and body). However, don't start using simple names in your tcl languages like this:
proc open {} {
set ::alarm_socket [open_socket $::options(-alarm_host)]

foreach host $::options(-hosts) {
verbose "open $host"
set ::sockets($host) [open_socket $host]
# set up an event handler for when data is readable on this socket:
fileevent $::sockets($host) readable [list process $host]
# initialise socket timeout with open time
set ::socket_t($host) [clock seconds]
Because open is what you might call a reserved word. (I should have known with open, but should I really have to remember all the reserved words?)

The error looked something like this:
$ ./test.tcl
invalid command name "::tcl::tm::UnknownHandler"
while executing
"::tcl::tm::UnknownHandler ::tclPkgUnknown msgcat 1.4"
("package unknown" script)
invoked from within
"package require msgcat 1.4"
("uplevel" body line 2)
invoked from within
"uplevel \#0 {
package require msgcat 1.4
if { $::tcl_platform(platform) eq {windows} } {
if { [catch { package require registry 1.1 }] } {
(file "/usr/lib/tcl8.5/clock.tcl" line 23)
invoked from within
"source -encoding utf-8 [file join $TclLibDir clock.tcl]"
(procedure "::tcl::clock::format" line 3)
invoked from within
"clock format [clock seconds]"
(procedure "alarm_timeouts" line 3)
invoked from within
... and so on. Yeuch! And it was encountered with this one line:
   puts "$::argv0: [clock format [clock seconds]]"
The problem? I redefined open, which was used internally by clock.

Real languages don't have types:

You can do lots of nice things in tcl without types, in a similar (but different) way to perl.
set a world
puts "Hello $a" ;# prints 'Hello world'
set a 1
incr $a
puts "$a + 2" ;# prints '2 + 2'
This looks normal to someone used to perl and tcl. Noticed how I don't need format specifiers or concat functions. You can also do this:

set a pu
set b ts
$a$b "Hello World"

Which prints:
Hello World

Real languages don't have comments

They have a comment command of course! And the comment command is a command that takes arguments (the comment itself) that aren't evaluated. Except that because of this, you can't have an unmatched brace in a comment:
# if ($sometest) {

The tcl solution?
if (0)
blocks or the like...


So if you haven't yet learnt tcl, I encourage you to find a tcl hackers tcl program, and delve into it to see just how it works.

If you try to learn tcl only by writing it and not by reading others' code, then you'll learn tcl with the habits you're used to, and you will possibly miss some of the powerful features.

After all, C programmers can program C in just about any language!
Copyright 2009 Another Blog. Powered by Blogger Blogger Templates create by Deluxe Templates. WP by Masterplan