How To: Fix USB Keyboards Missing the First Keypress in Linux

I use my laptop as a desktop with an external monitor, mouse & keyboard, and found that recently the keyboard would keep missing the first character of input – and it was driving me nuts. After much googling I found a blog post over at wulftone.com that narrowed the issue down to a USB sleep problem, and described how to blacklist a USB keyboard from going into sleep mode – and it works great!

The way to fix this issue is:

1 – Find the details of your USB keyboard via the lsusb command, like this:

2 – Once you can see your keyboard, if you can’t remember which way the vendor ID and product ID go (it’s that very order), you can get the details (in this case looking at the Microsoft keyboard on bus 003, device 002) like this:

3 – Next, edit (or create if necessary) the file: /etc/udev/rules.d/91-local.rules and place the following contents into it:

So for my USB keyboard I entered:

4 – Finally, with that done you can reload the udev rules with the following and you should be all set:

As a final note, I found that this (bizarrely) didn’t work when I used the lowercase hex codes (i.e. 045e & 00dd) – I had to put them to uppercase (045E & 00DD) for it to kick in!

Sanity restored! =D

P.S. If you want to disable your first (i.e. laptop) keyboard and/or are using laptop-mode-tools then the wulftone article has you covered. So many thanks to Trevor Bortin for this fix!

How To: Install Windows 7 Upgrade as a Fresh Install

Update: See the bottom of the post for another method of performing a upgrade install as a fresh install which only needs a single copy of your Windows 7 upgrade disc and nothing else!

Backstory

I’d had enough of fighting with OpenOffice 3.2 today and finally cracked: I bought a copy of Microsoft Office 2010 Professional Academic edition for $49AUD through Microsoft’s It’s Not Cheating program.

However, since I run Linux I thought I’d just get a copy of CrossOver and I’d be laughing, but this was not to be. I ponied up for Office, set it downloading, then went to get CrossOver only to find it only supports up to Office 2007 – and I don’t mean that Office 2010 won’t work 100%, or will be a little eratic – it won’t work at all. Feck!

Okay, so I can always run it through virtualisation (i.e. a VirtualBox or VMWare instance running some variety of Windows), but I didn’t fancy running the latest, greatest Office on a shonky old copy of XP, so I ponied up (again) for a copy of Windows 7 64-Bit Upgrade (that’s another $49AUD through It’s Not Cheating) and created a new virtual machine, installed Windows 7, entered the key at the end of the install, and it told me it wasn’t valid! Double feck!

At this point I’m $150AUD out of pocket with nothing to show for it, and am starting to furrow my brow.

Trying to deal with the key issue later – I just left the key out to get 7 up and running (it’ll go for 30 days without activation) and tried the key again from within the OS rather than from the installer; this time instead of just key invalid I got an error message stating that this key is not valid for a clean install of Windows… Okay.. now we’re getting somewhere – let’s fix this bad boy.

The Fix

There’s a bunch of stuff on the Web about forcing Windows 7 to accept a clean install from an upgrade disc by creating registry keys, running arcane commands (slmgr -rearm etc.), removing config files from the ISO before install etc. – and to be perfectly honest I didn’t fancy re-installing so I had a quick whirl at all of ’em. And guess what? They didn’t work, so I’m not going to post them here. Instead I’ll tell you what worked for me [drumroll please….]:

Installing another version of Windows first.

No, really.

It doesn’t have to be 64-bit if you’re migrating 32-bit to 64, it doesn’t have to be one step below Windows 7 (i.e. Vista), it doesn’t even have to be a legal, valid version of Windows! It just has to be some incarnation of Bill’s Marvelous Blue-Screen Machine, and then when you install Windows 7 on top of the existing install, it’ll recognise a prior version of Windows existed, and your “upgrade” key will work perfectly.

Windows 7 Activation
Ba-da-bing Ba-da-BOOM! Shamone! =P

So in my case, this just meant slapping a copy of XP onto a new virtual machine, then the instant that’s finished installing, just changing over the ISO image mounted on the virtual DVD drive from XP to 7, rebooting, and letting this second version of Windows install.

Once you’ve got Windows 7 up and running, your “old” copy of windows will be sitting in C:\Windows.old, and you can either use the built-in Disk Cleanup tool to remove it or just delete that folder and you’re as good as new*.

* = If you’re doing a native Windows 7 install, once you’ve removed the old install then you’re quite literally good as new. If you’re installing on a virtual box using a hard drive which uses dynamic storage (i.e. you allocate, say, 60GB for the HD, but it doesn’t take up any space to begin with, it only takes up space when data is added to the drive) then the space allocated for the old Windows install can’t be fully recovered because dynamic disks can take up more space, but do not resize back down to take up less space when you remove data! But you’re going to put more than 700MB of additional stuff on it anyway, right? So just remove the old Windows install before installing new apps and the like and you’ll break even!

Windown 7 - Remove Previous Windows Installations

It’s not a glamorous hack or sneaky workaround, but it does work, and who doesn’t have an old copy of Windows sitting around somewhere? If you’re feeling particularly cheeky you could try it with a copy of Windows 3.1 or 95 installed and see if it still upgrades clean ;-)

Update: I was discussing this with some colleagues the other day who clued me in to the following rather sneaky (but perfectly legitimate) method of installing Windows 7 Upgrade as a “fresh install”:

  1. Install Windows 7 as a fresh install and do not enter your key while installing.
  2. From within your installed and running (but not activated) version of Windows 7, go to your Windows 7 disc and install it again!
  3. If your Windows 7 Update disc doesn’t show setup type stuff (because it’s UDF and there’s all sorts of issues), just reboot the machine and install Windows 7 over Windows 7, um, dawg ;)

Cheers!!
Flattr this

Blog Stats Flat-Line Fixage

WordPress stats suddenly flat-lined to zero? Then you might want to double check that your footer is being displayed, like, you wouldn’t want to add a widget like an XBox 360 Gamercard to your blog and then forget to close the iframe enclosing it, resulting in the footer not being called, and the stats not being updated, would you? [sheepish-cough].

If your footer is being called but page hits still aren’t registering, I’d look into making sure your WordPress API Key is all set up properly (like edit the WordPress Stats plugin [through Plugins | WordPress Stats | Editor] and hard-code it briefly to see if that helps). Worst case scenario your database has corrupted and/or blanked the key, in which case you could read this and get ready to get your hands dirty with PHPMyAdmin…