Archive for September, 2007

PQI Sucks

UPDATE 2007/10/12: PQI have now replaced the card with a brand new one which appears to be in perfect working condition. In an apologetic note, PQI’s warranty department mention that Eddie (the guy who handled my original RMA) “is not longer working with PQI.” So, the issue ranted on below is most likely a fluke and not representative of the company as a whole.

The 2GB PQI ( branded SD card for my camera started going south and developed some bad sectors. Normally, I’d run chkdsk /r to seek out the bad sectors and mark them as such, but an SD card isn’t a hard drive: the computer talks to a (typically USB) card reader which talks to the device, and atttempting to read a bad sector causes different readers to fail in various unpredictable and reader-specific ways. Mine simply locks up and throws errors, refuses to perform any further reads or writes, which causes chkdsk to die with an “An unspecified error occurred” halfway through. Since the sectors can’t be marked bad, the camera will always try to write pictures to them*, which means I lose pictures (per Murphy’s Law, the very best ones). Not acceptable. So I go through the whole process of RMA’ing the defective card, since it claims to have a LIFETIME WARRANTY.

Anyway, I get a replacement card in the mail, sealed in a shiny new clamshell pack (that popular new kind of packaging that it takes three scissors and the Jaws of Life to open). Extricate it and…hmm, there’s already some wear on the contacts. Production testing? Sweet, they must have tested the shit out of this one, and it passed mustard. Hot stuff! Err…Ok, it’s more likely somebody’s old used refurb. So being ever curious, I decided to open it up in a sector editor and see if they’d at least wiped all the data off the card. It would really suck if they didn’t and my (hypothetical) nekkid pictures were being mailed to someone else after running the secret “remap spare hidden sectors over the bad ones” command not available to mere mortals and fixing it up. Sure enough, after a nice blank FAT indicating a formatted disk, I find a bunch of data beginning with a JPEG header.

Hmm… sure enough, the remnants of some poor sap’s pictures are on here. Wonder if they’re interesting… A few minutes with a file recovery tool later…

Hey, Bryce Canyon, I’ve been here! …Hey wait, these are MY pictures!

They repackaged and sent my same fucking defective card right back to me! ZAR (and chkdsk, etc.) also reveal that all the bad sectors are right where I left them…

PQI sucks.

"Hey, that guy with the beard looks familiar…"

*This of course assumes that the camera, or any other device the card is plugged into, contains a full FAT16 implementation, which for embedded devices is often not the case. Many cameras, mp3 players and similar gadgets will not reliably handle bad sector markings or even fragmented files, happily hosing any files it didn’t put there itself – or even ones it did, if you’ve deleted some other files nearby and left a hunk of free space just a wee bit smaller than the file it’s currently writing.

Code monkey get up get coffee; code monkey goto job

> DE wrote:
> Anyone interested in having a fantasy ice hockey league. No money
> involved, just for fun.

Does this involve quests and dragons?
My wizard's hockey stick has a +5 against Canadians...

T. R. Myself
etc etc

Disclaimer: When said Canadians are vendors, said stick also deals +4 pissed-off EE
damage and +n lamb nomination damage, where n is the number of available lambs.
NOTE: Flinging the dice at your opponent does 2d6 damage. But it may affect your
ability to participate in future games.

So, Tuesday begins the setup for Wednesday-Thurs’ big exhibition where hundreds of fellow corporate whores embedded geeks, wireless tweaks and sensor freaks exhibit their wares at the Boston Embedded Systems Conference. Including myself, as of 5pm Friday. Only one problem. That niggling little “yeah, you don’t have a demo together” problem, you say? Yeah, that’d be it. How smart you are.

Anyway, we’re sharing a booth with (Unspecified Vendor Eh?) since we have complementary technologies. This is really cool of them, since a booth is Wicked Expensive and the high-ups would have never sprung for it themselves (we’d have to sell, like, aboot 10 units just to break even). However, about a month ago, they kind of just dropped off the face of the planet, not responding to phone/email/voicemails/etc. starting aboot the day after we met with their sales rep in person. Now, as a small R&D company, I’m sort of used to this by now. Vendor sees we’re a small R&D company (“…marketing strategy? We put a blurb on our web site, what more do you want? …Yes, technically our marketing department is GoDaddy), realizes he’s wasting his breath and *poof* gone. So, when I suddenly got a reply to Thursday’s hail-mary email, I have to admit I was kind of caught with my pants down around my bootloader. So Sunday and today have been spent jerry-rigging a demo together, and realizing how [bleeping] much I [blippity] hate [nargin] MATLAB, the [@instrcallback] Language of [razza-fragga] Standing on the [message redacted] Street Corner Doing One [readasync()] Thing. Looks like tomorrow will be too*. I also discovered why laboratory shakers are so expensive, after trying and failing to build my own from scrounged lab gear. Once again that dissected Drmn’ toy has become a vibration source for an energy scavenging demo.

*Exploration for today: Discovering what particular flavour of crack MATLAB is smoking such that plotting points to a figure only causes said figure to update after the script terminates, which is non-optimal behaviour when said script is to read its input data continuously from a serial port from aboot 2-7pm, the length of time I’m sitting with it in a booth demoing. Oh, and it supports callbacks (triggered by, say, serial port carriage return), but only when not executing a loop, but also only in response to a readasync() which, if you’re reading more than one line, is in a loop.

Bulk update

Lastlastlast week JR, Matt, HAL and I went rock climbing at MetroRock in Everett, kind of like a meta-birthday party. This was fun. I haven’t done any serious climbing since high school, and had to relearn all the knots, etc. Here at least they believed in actual fabricated harnesses; we didn’t have to go all retro and tie our own out of seat belt material (yes, it can and has been done, go LTHS). Also, did some hanging out with Kr*, who amazingly hasn’t thrown me to the curb yet ;), and (re-)discovered the suck that is the Green Line. I thought it would be better than the suck of trying to find parking near BC, but I guess not really. My train got delayed by half an hour by a Medical Emergency at the next station. For a while visions of a tattoo-clad SuicideGirl throwing herself in front of a train wandered in my head, but after a while of sitting in the train with nothing much to do except chat with the driver, it was found that an old lady slipped and fell on the train one station ahead of us. Apparently, when this happens, by MBTA policy everything must grind to a halt, stopping trains until both paramedics and MBTA officials and a replacement driver arrive on the scene. Yes, even if some crack-addled nutjob hurts himself rolling down the aisles and beaning himself at the end of the car, you’ll find the hapless driver in the fishbowl of Park Street(?) getting an interrogation and drug test, because of the very slim but nonzero possiblility that the accident can be blamed on the driver (e.g. old lady fell because he hit the gas too fast). Yeah, I’m pretty glad that my biggest worries at work are Mechies or magazine salesmen harassing me while I’m trying to get actual Stuff done.

We also celebrated the waning summer with a big BBQ of uber-thick cuts of beef (or beef tatake, as I “cook” ’em ;) and a Costco of slow-cooked pork ribs. Of course lacking any sort of furniture to accommodate this many people, I ghettoed something together. The seating was mostly milk crates and two collapsible chairs; this posh dining table is an old trash-rescued closet door with its hinges resting on a trash barrel on either end. But the ribs and sides were tasty :-) Including a pretty good Aunt Token’s Cornbread and Kr*’s kick-ass potato salad. There was a mild scare when the oven decided to hold the ribs hostage! There’s this little lever that locks the door shut, which I thought was for just locking the door shut while you cook (the oven’s old and the door doesn’t close as fully as it probably should, unless the lock lever is pulled). Apparently though, this is probably meant to go with the self-cleaning feature (where it heats up to solar-flare temperatures and literally vaporizes any accumulated cruft), and, when engaged, has some thermally-activated mechanism that locks the door closed until the oven cools off. Luckily we were slow-cooking the ribs at low temperature, so it didn’t take that long for the oven to cool off a bit and they didn’t mind an extra 15 minutes or so in there. The door unlocked while we were in the middle of disassembling the top of the oven to get at the thermal latch and disable it (which is still a good idea, see my past rants on gadgets overriding their owners’ decisions).

Zipped off on short notice to Roanoke to do some testing, as mentioned here. Turns out I didn’t get steel-toe shitkickers, but plenty of G-W swag instead (rotating mint project enclosure! Plus a free hat, tire pressure gauge and a huge tin of VA’s finest peanuts. The testing went much smoother than I had anticipated, given previous experiences, and I can now say I’ve ridden in the engine cab of a rolling locomotive. There was enough time left over to catch a nice lunch, get some reading in and play a substantial amount of Mario Kart DS. (Of course, the minute I’m back in the office production is crawling down my throat with a new CNC router emergency, but that’s a rant for another day!)

Last weekend, off to Connecticut for Kr*’s friend’s graduation party. Good times, open cooler, almost Olympic sized swimming pool in the backyard and some crazy-ass beachball volleyball.

Finally making some small progress on the house thing. We’ve got enough dinnerware to go around, and as of a couple days ago, with the help of JR and Kr*, (via the Ikea Experience) a big dining room table and chairs (plus 150XP in 2-Door Nissan Furniture Tetris :P, and enough Gorilla Glue on my hands to ensure no more Traffic Finger for the next 2 months). I even got real ambitious and cleaned about a hundred years’ dust off the crazy retro chandelier. Procedure: Unhook all the glassy bits, throw in a bucket with dish soap, turn garden hose on OMGWTFJET setting and blast the shit off them (mabye fill the bucket 1/3 and shake them around for a minute to be sure). A bunch of those little hooks come out, but they’re solid metal, so as long as your bucket isn’t ridiculously short they’ll stay around the bottom of the bucket and not get lost. Dump off all the suds and dust-water, reclaim your glass and metally bits and you’re done. Tonight JR and I (with some help from HAL and LE) ripped up the upstairs bedroom carpets, cutting them into strip rolls and taping up for the garbage man. We’ll find out next week if said garbage man will take them (old carpeting and underfoam may be considered Construction Trash and need some special dick-sucking permit). Found some critters living within, inclunding a silverfish and a couple beetles (last month during initial carpet yanking; became plant food) and a spider tonight that just got squished and rolled. Maybe the crazy apartment lady was onto something with the whole carpet thing.

Secret Incantations for correctly configuring Ubuntu

Yeah, I made that mistake the other day setting up a temporary machine to compile dslinux on. I guess it’s not all bad… just not at all what I expected from everyone else’s ranting and raving. Anyway, if you already have no idea what I’m talking about, it might be a good idea to skip this post. It’s here mostly for my own documentation in case I ever have to do this again.

Getting Broadcom wireless card to work (bcm43xx and fwcutter):
Broadcom are a bunch of douche bags and don’t support anyone trying to write a Linux driver for their stuff, so currently how to get these to work is with a reverse-engineered hack someone wrote, but it requires a copy of the card’s proprietary, copyrighted etc. firmware extracted from e.g. the Windows driver file using a program called bcm43xx-fwcutter. Obviously, they can’t include this copyrighted material on the Ubuntu install CD (see Restricted Drivers rant later on), so get some floppies handy. Apparently though, (once you install and get it working using floppies), it’s perfectly acceptable for them to have the installer download the copyrighted Windows driver from a warez site some guy’s free web hosting account (which unfortunately has long ago been deleted, so this doesn’t actually work anyway) (on Googlepages, which is kind of like a geocities account with slightly less censorship, but apparently not slightly less enough).

So the steps are:
Download bcm43xx-fwcutter
Download bcmwl5.sys from wherever and cross fingers that it’s a supported version
Consult fwcutter’s help for extraction steps
Copy the resulting files to /lib/firmware/x.x.y.y/generic/ (where x.x.y.y varies depending on your current kernel version)

* Re-perform this incantation whenever package-updater-ma-dealy quietly changes kernels on you and your wireless stops working (re-copy all the *.fw files from e.g. / to / Print this page for next time this happens and you can’t access my blog anymore to see these fixes.)

Restricted 3D driver and Desktop Effects (i.e. recovering your desktop now that it hangs):
Problem: You saw something called ‘Desktop Effects’ in the menus and had to go playing with it, didn’t ya. *click* So it had you install a Restriced Driver* for your video card, which unlocked two mildly interesting (though useless) Desktop Effects: one makes desktop windows wibble-wobble around when you drag them (like you were tugging on Jell-o), and the other does this rotating cube thing with your desktops (hard to describe succinctly). Anyway, the Restricted Driver made things flaky, so you retraced your steps and un-installed it, but didn’t think to un-check those two little Desktop Effects tickboxes first, because removing the Restricted Driver is supposed to take care of that, right? Anyway, now your beautiful Ubuntu desktop crashes just after login with a white rectangle followed by a White Screen of Death. You Googled it and found that this is because you didn’t untick those GUI checkboxes first, but now you can’t untick GUI checkboxes because the GUI no longer works.

Solution (at least worked for me): Go into your home directory, delete .gconf, .gconfd, .gnome, .gnome2, .gnome_private, and .nautilus (and any subfolders/files), cross fingers and reboot.

Make no mistake, this lack of sanity-checking is a BUG and needs to be fixed.

Obviously, this setting is stored in a .conf file somewhere, and with a two-line edit to this file you could fix things right up. However, despite a metric assload of people having been bitten by this same stupid bug (as evidenced by volumes of forum posts), not one forum post successfully identifies where this tickbox setting is buried**.

Do not run ‘dexconf’ under any circumstances, including in an effort to fix the previous problem, no matter if someone in a forum got this to work fixing their x11/xorg config files on some specific setup. If you already did, hope you’ve got your old xorg.conf backed up somewhere. I thought this would (like similar scripts for Debian) ask a bunch of questions about your monitor timings etc., back up your old file, ask your permission to overwrite yours with the new carefully-chosen settings, that whole first-date semaphore. Yyyyyeah, like notsomuch. Actually, it goes zzzip and kills your old file, and your chances of running X ever again along with it (unless you have a backup).

Shared Folders (aka Samba aka Network Neighborhood)
Shared a folder in Ubuntu using the pointy-clicky widget, and you can’t connect to it from other machines. Just get asked for your password over and over, if even that.

Solution: In Debian, you’d set up a shared directory by hand-editing smb.conf. In Ubuntu, you set up a shared directory by right-clicking on it and ‘Share…’, then fix it by hand-editing smb.conf.

[in global config]

[in share’s config]
public = yes

chmod -R 777 your_shared_files might help too (cargo cult; I did it At Some Point during trying to get it to work, so no idea if it helped at all or if it’s actually needed), assuming you extremely trust everyone who can get at them.

Running fsck from install / recovery disk:
Ubuntu has no ‘root’; it’s all done with this sudo stuff. So booting the install disk to fsck some disks before they mount, no root there either. Luckily ‘sudo <dangerous_root_command>’ will do the trick, no password needed.

Running VNC (x11vnc), or probably services/daemons in general
In Debian, installing the package would also perform all the necessary voodoo to let the service autostart at boot. Some entries in init.d, rcWhatever.d, inetd, etc. Not so with Ubuntu, apparently.

To set password (step 1): vncpasswd
To run vnc server once (see if it works) (step 2): x11vnc -usepw -rfbport 5900 -shared -forever -nowf -norc -notruecolor -scale 4/5 -scale_cursor 1 -desktop computer_name -bg
To make it run every time (step 3): (TODO: FIXME)

Browsing Windoze boxes’ shares from Ubuntu:

So yeah, about this Ubuntu thing…I’m not liking it. Think I should have stuck with Debian Sarge.

* Since most video card manufacturers would rather swallow a pineapple rectally than release an open-source driver for their card, and most Linux packagers would rather have a family of rabid hedgehogs living in their urethras than soil their distro with a non-open-source package, there’s this whole big ta-do about getting the thing installed, and they let you know it. In Ubuntu, this finger-wagging is performed through something called the Restricted Drivers manager. When you install a Restricted Driver, the lights in the room dim, ominous music plays, and over a Latin chant seranade a reanimated dead voodoo chicken from out of nowhere skitters across your living room floor and disappears down the basement steps, never to be seen again. Then your 3D applications all run quite a bit faster, at least theoretically.

Now, I just installed this new system two days ago to do one very specific task; I don’t want to spend the next two weeks reverse-engineering it to figure out how all these weirdly-named GUI-related processes interact with each other and where each of them writes its config files. I know what X (~= X11 ~= XFree86 ~= XOrg) is and that all things graphical (starting with a Window Manager; I assume this one is Gnome given the funky foot thing and ‘.gnome’ hidden file in my home directory) run on top of it, but what’s gdm? gconf? Is that different from gconfd? Nautilus? Metacity? That sounds like some kind of screensaver, or maybe something a really bad cancer might do. If I want to track down where that tickbox setting is hiding, I first need to know which of these dozen cryptic window-popping programs is responsible for popping that particular window, the one with those two little Desktop Effects tickboxes on it.

I guess I’m not the only one who just wanted to ‘joe /home/tim/mystery.conf’ and change the appropriate line to ‘wibbly_wobbly_windows = off’ to unfuck things, but couldn’t find the setting. All afflictees giving or receiving help on Google-accessible forums suggested various sledgehammer-cult approaches, like uninstalling the packages named ‘compiz’ and ‘beryl’ using the commandline package manager (now wtf are these? Are they in addition to the dozen no-name graphical voodoo packages already mentioned? Anyway, removing these also causes a package named ‘ubuntu-desktop’ to be removed, which sounds pretty important, but apparently isn’t, because I haven’t noticed any change. But it didn’t solve the problem, either), or the approach that eventually worked for me, deleting .gconf, .gconfd, .gnome, .gnome2, .gnome_private, and .nautilus (and any subfolders/files) from the home directory and rebooting.