Category Archives: What?!

The Intel QX3 Microscope

Well, the bad news is the ant colony I was rearing has died off. I’m unsure what the problem was, but the ant queen was found dead, followed by the only two offspring dying a couple of days later.

I don’t have a decent digital camera that can take decent pictures of something as small as an ant, and I came across an old article detailing an interesting childrens toy: The Intel QX3 microscope.

The QX3 Microscope
The QX3 Microscope

It was released about 10 years ago, so I’m obviously behind the times. The resolution isn’t the greatest (the QX3 is a first-gen, but the QX5 has some improvements including better resolution).

The device runs well on linux, you need the following configuration options (in addition to normal USB drivers):

CONFIG_VIDEO_CPIA=m

CONFIG_VIDEO_CPIA_USB=m

The camera (the microscope is basically a webcam) has a number of interesting settings, all touchable via the /proc filesystem:

——– current min max default comment
brightness: 50 0 100 50
contrast: 48 0 96 48 steps of 8
saturation: 50 0 100 50
sensor_fps: 3.750 3 30 15
stream_start_line: 240 0 288 240
sub_sample: 422 420 422 422
yuv_order: YUYV YUYV UYVY YUYV
ecp_timing: normal slow normal normal
color_balance_mode: auto manual auto auto
red_gain: 15 0 212 32
green_gain: 31 0 212 6
blue_gain: 39 0 212 92
max_gain: 8 1 8 2 1,2,4 or 8
exposure_mode: auto manual auto auto
centre_weight: on off on on
gain: 4 1 max_gain 1 1,2,4,8 possible
fine_exp: 2 0 510 0
coarse_exp: 302 0 302 185
red_comp: 220 220 255 220
green1_comp: 214 214 255 214
green2_comp: 214 214 255 214
blue_comp: 230 230 255 230
apcor_gain1: 0×18 0×0 0xff 0×1c
apcor_gain2: 0×16 0×0 0xff 0×1a
apcor_gain4: 0×24 0×0 0xff 0×2d
apcor_gain8: 0×34 0×0 0xff 0×2a
vl_offset_gain1: 20 0 255 24
vl_offset_gain2: 24 0 255 28
vl_offset_gain4: 26 0 255 30
vl_offset_gain8: 26 0 255 30
flicker_control: off off on off
mains_frequency: 50 50 60 50 only 50/60
allowable_overexposure: 141auto auto 255 auto
compression_mode: auto none,auto,manual auto
decimation_enable: off off on off
compression_target: quality framerate quality quality
target_framerate: 15 1 30 15
target_quality: 5 1 64 5
y_threshold: 12 0 31 6
uv_threshold: 11 0 31 6
hysteresis: 3 0 255 3
threshold_max: 11 0 255 11
small_step: 1 0 255 1
large_step: 3 0 255 3
decimation_hysteresis: 2 0 255 2
fr_diff_step_thresh: 5 0 255 5
q_diff_step_thresh: 3 0 255 3
decimation_thresh_mod: 2 0 255 2
toplight: off off on off
bottomlight: off off on

You can alter any of these settings by doing something like:

echo “bottomlight: on” > /proc/cpia/videoX

(I’ve found that you need to have the camera actively in use for these settings changes to actually work).

Two programs work well with the camera – xawtv and tvtime. TvTime has a few minor issues that I’ve yet to work out, but I’ll figure that out eventually (namely the buffer isn’t filling up properly). XawTV has an issue with screencaptures – again an issue I’ll work out shortly.

For better images, I’ve found that setting sensor_fps to 10 works well. One I have a specimen on the slide and in proper position, I drop that to 3 to actually take the image.

As I mentioned earlier, the resolution isn’t that great.  I’ve been told lighting is the key, and I’m still experimenting. Here’s the head of the queen ant, I’m sure of species:

Queen ant, taken w/ QX3
Queen ant, taken w/ QX3

Pinnacle PCTV Pro

My old BrookTree Tuner card died recently. I only used it for basic chores – backup of VHS tapes, maybe watching the Deadliest Catch while I worked…

My old generic card (if you want it, pay for shipping and it's yours)
My old generic card (if you want it, pay for shipping and it's yours)

Everyone online is building DTRs using the latest technology, but that’s not how I generally work. Cheap and worthy is about the only qualification I have – and you can pick up a nice Pinnacle PC-TV Pro online for $25.00. (ebay)

The bigger problem is determining the tuner… a difficult task to do when looking at a picture of an item on ebay. When doing research on a BTTV card – I’ve got to recommend http://www.bttv-gallery.de/

Someone thankfully put a lot of research into this site. If you search around, there’s a lot of griping on the internet about “the tuner doesn’t work on so-and-so card”. Using this site, I was able to easily discern different revisions of AcerTV and Pinnacle cards – which is important when you plan on using the card under Linux.

So, here’s my card:

01:07.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
Subsystem: Pinnacle Systems Inc. PCTV pro (TV + FM stereo receiver, audio section)
Flags: bus master, medium devsel, latency 64, IRQ 17
Memory at fc0fe000 (32-bit, prefetchable) [size=4K]
Capabilities: [44] Vital Product Data <?>
Capabilities: [4c] Power Management version 2
Kernel driver in use: Bt87x

I’ve found that for sound support, you want to make sure to load the “tuner” module PRIOR to inserting the “bttv” module  (otherwise you’ll end up with no sound). The module options that worked for me were: “bttv card=39” and “tuner=33”. If you’re looking for a full list of card and tuner numbers, look at the Linux source Documentation/video4linux/CARDLIST*

For viewing, I’m using xawtv and tvtime. I’m still fighting w/ sound issues – one _should_ be able to either set /dev/dsp1 (the bt card on my system) as the audio source – but I’ve yet to get that to work correctly.

One can also use SOX to pipe /dev/dsp1 to /dev/dsp0, but I’m still battling w/ that. I believe the following should work, but have yet to get it to execute w/o throwing errors:

sox -q -c 2 -s -r 32000 -t alsa hw:1 -t alsa -r 32000 hw:0

My current workaround is a simple 3.5mm male/male connector to connect the output of the PCTV Pro to the Aux Input of the onboard soundcard.

Recording from the card is fairly easy, too.  XawTV has an application called “streamer”, but I’m much more inclined to use menconder (part of the mplayer package):

mencoder -oac mp3lame -ovc lavc -lameopts mode=1:vbr=2:q=4 -lavcopts vcodec=mpeg4 -tv driver=v4l:norm=ntsc:channel=3:chanlist=us-cable:adevice=/dev/dsp:width=640:height=480 -af volume=-25 -o /tmp/tv.avi tv://


Mounting a raw dump (using dd and losetup)

I’ve just picked up a DT Research WebDT366 Tablet. I’m in need of a good touchscreen for a CarPC project, and the Lilliputs are a little more expensive than I had hoped to go (Appx, $250.00 on Ebay).

First boot (I'm finishing up the Gentoo Linux Image)
First boot (I'm finishing up the Gentoo Linux Image)

The WebDT366 was only $90 (in fairly good condition), and I figured if I didn’t end up using it for a CarPC (or as simply the touchscreen for the CarPC), I could certainly find something else to do w/ it.

tschak909 has already done a good amount of work getting Linux to run on the device. (http://forum.linuxmce.org/index.php?topic=6663.0). Thankfully it’s x86, so life should be a little easier when building custom images.

Wanting to know what packages and configuration Thom has used in his installation, I needed a way to mount the raw disk image (http://www.localeconcept.com/private/webpad-beta2.dd.bz2). Googling didn’t get me at the exact answer, but it got me close enough to figure it out.

First off, use losetup and and offset (flagged by -o).  When running “file” on the image, you’ll see something like this:

lennybruce ~ # file /tmp/webpad-beta2.dd
/tmp/webpad-beta2.dd: x86 boot sector; partition 1: ID=0x83, active, starthead 1, startsector 63, 1023057 sectors

As you can see, partition one starts at sector 63. (512 bytes * 63 = 32256). Having this information, mounting is easy:

lennybruce ~ # losetup -o 32256 /dev/loop0 /tmp/webpad-beta2.dd
lennybruce ~ # mount /dev/loop0 /mnt/loop
lennybruce ~ # ls /mnt/loop/
bin   cdrom  etc   initrd      lib         media  opt   root  selinux  sys   tmp  var
boot  dev    home  initrd.img  lost+found  mnt    proc  sbin  srv      temp  usr  vmlinuz
lennybruce ~ #

That’s it for mounting a raw disk image. Using the information Thom has provided in his image (video driver, input drivers, etc)… I’m building a custom Gentoo image that will hopefully be the basis or front-end of a CarPC.

Unable to bind to the destination server in DNS

Ok, so this error message has been a royal PITA for me today. I’ve ran through numerous MS Knowledgebase articles, multiple forums, and all to no avail. The problem arose when an ASP script using CDONTs to send mail ended up placing all messages in the “Queue” directory… with no further processing. The solution: Live life by packet captures.

Oh, and make sure you’re reading them correctly.

It turns out Windows 2000 server (used for a webserver in this instance), performs DNS queries via TCP instead of UDP. The DNS servers that it was configured to use apparently had some issue – made evident by numerous TCP retransmits, and no actual query responses in any packet captures. Of course, nslookup uses UDP for DNS resolution – and UDP requests resolved fine.

Dig supports tcp queries using the +tcp flag. A simple query made it obvious that things were borked:

kovacs2 ~ $ dig +tcp -t a www.braindeadprojects.com @goofyassednameserver

; <<>> DiG 9.5.0-P2 <<>> +tcp -t a www.braindeadprojects.com @goofyassednameserver
;; global options: printcmd
;; connection timed out; no servers could be reached

I’ve scoured the net looking for a way to set Win2k to only use UDP DNS queries, to no avail. The real solution though is to fix the nameservers, which restarting the service did without issue.

I really wasted WAY too much time on this dumb issue. In retrospect, I would have installed Wireshark sooner, and performed a more controlled packet capture. Part of my problem was that I was actively using nslookup during packet captures, and not reading the captures thoroughly.

Request,response,request,response, request, response… all the while not noticing that TCP requests never received a response. RTFPcaps friends!