Archive for the ‘Hardware’ Category

The built-in SD card reader on my Thinkpad x60 has been always giving me headaches. It works reliably well, but when copying files my system becomes very unresponsive. The mouse is jerky and the CPU usage jumps through the roof. Obviously, DMA is not being used.

I couldn’t find much about it for a while but just today, when I included the chip id R5C822 of the reader in the search I found this thread.

However, instead of patching the source itself, it is quite easy to force the quirk when loading the sdhci module. Put the following in modprobe.conf or /etc/modprobe.d/local.conf and everything will be fine after you reboot.

options sdhci debug_quirks=2

You can also reload the module to check if it is fine even now.

  • umount any SD cards that you have mounted
  • modprobe -r sdhci-pci
  • modprobe -r sdhci
  • modprobe sdhci-pci

That’s all folks. Enjoy a true multitasking Linux.

I just got a brand new Microsoft Natural Ergonomic Keyboard 4000. The keyboard is great, but its left Alt key is a bit too small a bit too much to the side and very hard to reach with my thumb. Japanese keyboards have three extra keys around the space bar, keys that I never use, but keys that eat the width of other keys (just look at the English and Japanese variants and you’ll see what I mean). I thus wanted to assign that never-used-key to behave the same as an ALT. It turned out to be easier than expected.

Detailed information about the process can be found in an article from Microsoft. It tells you that you need to add a binary key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\Scancode Map. Its first eight bytes are all zeros, the next four bytes are the number of mappings (little-endian, so “02 00 00 00″ for 2), and then four bytes for each mapping plus a mapping of all zeros (”00 00 00 00″) as a terminator.

The number of mappings should include the terminator, so if only want to map one key you’d need to say that you have two mappings.

The mapping are written out by concatenating two short words (16-bit integers) in the order “from”-key, “to”-key. However, bear in mind that you have to reverse the bytes in the registry (little endian still). This can be confusing, because you byte-swap the concatenated word, and not the two short words that make it up. In other words the first byte you write would be the lower byte of the destination key, then the higher byte of the destination, lower byte of the key being mapped and finally the higher byte of the key being mapped.

So, to make your caps lock key behave as control, you would write the following

Value Bytes Explanation
00 00 00 00 00 00 00 00 0-8 Header and flags, all zero for now
02 00 00 00 9-12 Number of mappings, 2 (caps -> control and null)
1d 00 3a 00 13-16 Caps -> Control. 0×003a is Caps, 0×001d is Control. 0×003a001d –> 1d 00 3a 00
00 00 00 00 17-20 Terminator mapping

The codes for the keys are available in a related article from Microsoft. You can download a doc or pdf file that has all possible keys (including the weird keys on Japanese, Korean and so-on keyboards).

And here is what I used to swap control and caps lock and map the three Japanese keys to Alt:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
“Scancode Map”=hex:\\
      00,00,00,00,\\
      00,00,00,00,\\
      06,00,00,00,\\
      3a,00,1d,00,\\
      1d,00,3a,00,\\
      38,e0,79,00,\\
      38,e0,70,00,\\
      38,00,7b,00,\\
      00,00,00,00

Here is also a Caps Lock to Control
registry file.

A few common problems when setting up a stateful firewall to allow FTP traffic.

FTP needs a separate data connection for transferring files or file listings. It has two modes of operation

passive
The clients request the server to listen for a connection. The server responds with the address and port where it is listening for the data connection. The client connects.
active
The client listens on a port for the data connection. The client notifies the server about the address and port. The server connects to the client

Stateful firewalls only allow specific traffic or already established/related traffic. Since the data connection uses a separate port it cannot easily be distinguished as being related to the legitimate FTP connection. This is where the helpers come in play.

ip_conntrack_ftp is a module that monitors ftp traffic and marks a data connection as RELATED to the control connection of a FTP session. When using the module, make sure you pass the option ports=21, or it will monitor all traffic and probably be very slow. This is easily done from /etc/modules.conf.

In order to allow data connections behind a NAT, the ip_nat_ftp module can do the trick. The ip_nat_ftp module depends on the the ip_conntrack_ftp module and does not need any parameters.

If the FTP session is encrypted (TLS for example) there is no way to statefully let the data connections through. When running a FTP server behind a NAT that allows encrypted connections the only solution is to specify the ports that it will listen on for passive connections and explicitly allow those.

The modules needed for properly setting up lm-sensors on my Tyan motherboard are:

  • i2c-nforce2
  • lm85
  • k8temp

And the lowest version of lm-sensors with support for k8temp is 2.10.1.

I am still at a loss about reading the output, though.
# sensors
lm85-i2c-0-2d
Adapter: SMBus nForce2 adapter at 2d00
V1.5: +1.81 V (min = +0.00 V, max = +3.32 V)
VCore: +1.25 V (min = +0.00 V, max = +2.99 V)
V3.3: +3.25 V (min = +0.00 V, max = +4.38 V)
V5: +4.97 V (min = +0.00 V, max = +6.64 V)
V12: +12.06 V (min = +0.00 V, max = +15.94 V)
CPU_Fan: 0 RPM (min = 0 RPM)
fan2: 1626 RPM (min = 0 RPM)
fan3: 0 RPM (min = 0 RPM)
fan4: 0 RPM (min = 0 RPM)
CPU Temp: +40°C (low = -128°C, high = +127°C)
Board Temp:
+36°C (low = -127°C, high = +127°C)
Remote Temp:
+46°C (low = -127°C, high = +127°C)
CPU_PWM: 255
Fan2_PWM: 255
Fan3_PWM: 255
vid: +1.550 V (VRM Version 2.4)

lm85-i2c-0-2e
Adapter: SMBus nForce2 adapter at 2d00
V1.5: +1.80 V (min = +0.00 V, max = +3.32 V)
VCore: +1.25 V (min = +0.00 V, max = +2.99 V)
V3.3: +3.25 V (min = +0.00 V, max = +4.38 V)
V5: +4.97 V (min = +0.00 V, max = +6.64 V)
V12: +12.12 V (min = +0.00 V, max = +15.94 V)
CPU_Fan: 1167 RPM (min = 0 RPM)
fan2: 1218 RPM (min = 0 RPM)
fan3: 0 RPM (min = 0 RPM)
fan4: 0 RPM (min = 0 RPM)
CPU Temp: +33°C (low = -128°C, high = +127°C)
Board Temp:
+35°C (low = -127°C, high = +127°C)
Remote Temp:
+32°C (low = -127°C, high = +127°C)
CPU_PWM: 255
Fan2_PWM: 255
Fan3_PWM: 255
vid: +1.550 V (VRM Version 2.4)

lm85-i2c-1-2d
Adapter: SMBus nForce2 adapter at 2e00
V1.5: +1.81 V (min = +0.00 V, max = +3.32 V)
VCore: +1.25 V (min = +0.00 V, max = +2.99 V)
V3.3: +3.25 V (min = +0.00 V, max = +4.38 V)
V5: +4.97 V (min = +0.00 V, max = +6.64 V)
V12: +12.06 V (min = +0.00 V, max = +15.94 V)
CPU_Fan: 0 RPM (min = 0 RPM)
fan2: 1626 RPM (min = 0 RPM)
fan3: 0 RPM (min = 0 RPM)
fan4: 0 RPM (min = 0 RPM)
CPU Temp: +40°C (low = -128°C, high = +127°C)
Board Temp:
+36°C (low = -127°C, high = +127°C)
Remote Temp:
+46°C (low = -127°C, high = +127°C)
CPU_PWM: 255
Fan2_PWM: 255
Fan3_PWM: 255
vid: +1.550 V (VRM Version 2.4)

lm85-i2c-1-2e
Adapter: SMBus nForce2 adapter at 2e00
V1.5: +1.81 V (min = +0.00 V, max = +3.32 V)
VCore: +1.25 V (min = +0.00 V, max = +2.99 V)
V3.3: +3.25 V (min = +0.00 V, max = +4.38 V)
V5: +4.97 V (min = +0.00 V, max = +6.64 V)
V12: +12.12 V (min = +0.00 V, max = +15.94 V)
CPU_Fan: 1167 RPM (min = 0 RPM)
fan2: 1218 RPM (min = 0 RPM)
fan3: 0 RPM (min = 0 RPM)
fan4: 0 RPM (min = 0 RPM)
CPU Temp: +33°C (low = -128°C, high = +127°C)
Board Temp:
+35°C (low = -127°C, high = +127°C)
Remote Temp:
+32°C (low = -127°C, high = +127°C)
CPU_PWM: 255
Fan2_PWM: 255
Fan3_PWM: 255
vid: +1.550 V (VRM Version 2.4)

k8temp-pci-00c3
Adapter: PCI adapter
Core0: +46°C
Core1: +47°C

k8temp-pci-00cb
Adapter: PCI adapter
Core0: +47°C
Core1: +51°C

There is no such thing as coolers for a Socket F. There isn’t enough information on the internet for me to actually say anything that I can vote for, but here is my experience.

On my Tyan Thunder n3600B there are two couples of retention brackets. These brackets are screwed around the socket and it is thus possible to use any cooler that is compatible with Socket AM2.

Since I was stupid enough to buy a couple of coolers that are too big to fit when placed close to each other (the sockets are a bit too close, but that’s what I get for getting an ATX motherboard) I also learned that coolers for Socket AM2 are compatible with Socket 754, and possibly all other recent AMD sockets. After all, it is just a clip and luckily the dimensions of that clip haven’t changed much.

After trying to use jumbo frames on my newly upgraded network and realizing that one adapter is not enough, I simply left things as they were. Come today, my NFS mounted directories on the server were unaccessible and none of restarting the NFS server (just the NFS server process, not the machine itself) unmounting the directories or trying to mount them again helped. Eventually a little playing around with tcpdump on both the server and client
tcpdump -i any port 2049 revealed that the client was sending requests and the server the appropriate responses, but for some reason the responses were not reaching the client. Quickly disabling the jumbo frames on the server ip link set mtu 1500 dev lan and everything was back in order.
Conclusion: Jumbo frames are evil.

Update: The Gentoo Linux Wiki has a nice tip about jumbo frames and NFS and why it is not good to mix jumbo with standard frames.

The server that this blog is running on has served me well. It is running e-mail with SPAM and anti-virus filtering, officially mirroring several OSS projects and it is also serving several web pages. It is doing its job well, but it has been pushed too hard and it is time for a replacement. When putting it together (actually upgrading it from a Slot A Athlon) I had bought an ASUS P4S533-X motherboard which allowed my to go with a cheap Celeron running at 2.4GHz and reuse two of several PC133 512MB DIMMs (buying DDR would have been too much for me at that time). And it has run like that for quite a while.

When I decided to upgrade the machine, I decided that I’ll buy something that is going to run for a while. So I decided to go with a couple of the new dual core Opteron processors (the HE type) a reasonable TYAN motherboard and four pieces of 512MB DDR2 DIMMs (registered memory is still too expensive). So, it was hard enough to find a retailer carrying all these items in Japan… it seems that if you want to buy the latest and greatest gaming hardware you can step in any shop, but for server hardware you have to look high and low. Fortunately I did find a shop. MYSPEC.com obviously specialize in server hardware and have everything that I need. There is also PC-IDEA who do have plenty of stuff, but the prices of what I was looking for are a tad higher and the choice of CPUs non-existent. They do have plenty of Socket F motherboards, but the guys at MYSPEC.com did have what I need.

Anyway, the real problem appears to come when buying a cooler for the CPUs. Apparently such a thing as Socket F coolers does not exist. Well, not for us, ordinary people it doesn’t. Part of the fault seems to go to AMD, who apparently released two different specifications for the Socket F. It also seems that most of the currently released boards are compatible with the older Socket 940 coolers. I also read that TYAN are specifically including clips that would allow Socket 940 to be used with their Socket F motherboards. I cannot find the links now, but I guess I’ll get a couple of Socket F coolers and hope for the best. It’s frustrating… buying a 250,000 yen computer and being unable to find a cooler or at least some information as to what cooler to buy. It’s probably best to simply ask the guys that I’m buying from.

I got a new Intel Pro/1000 XT server adapter, a so-so switching hub (NetGear GS105) and I immediately upgraded my network. Since both the Intel adapter and the switch were jumbo frame compatible, I decided to try that feature out. Ran the following commands on the server (with the Intel adapter):
ip link set mtu 9000 dev lanand after a small delay everything seemed to be OK.

Ran the same command on my workstation — an Asus K8V SE Deluxe motherboard with an onboard Marvell Gigabit adapter. The screen froze and after a few seconds the computer rebooted. That’s with a vanilla 2.6.18.5 kernel. Gotta be more careful.