Reverse engineering the protocol of a DLC300 USB camera

I happened to buy a USB camera over ebay, that didn't work in linux. It was listed as a "3.0MP USB2.0 Digital USB c-mount Camera for Microscopes". This page is a short description of how I got it working under linux.

The first thing to do is to search for its vendor ID and product ID in google (1578:0076), hoping to get some hits somewhere. All I could determine, was that it completely lacked drivers and there was a few unanswered questions about it in a few forums.

Next step was to open it up, to see if there was any clues about how to get it working. Even though the serial numbers of the top board in the camera module had their markings scraped off, the main chip, a USB bridge from Cypress had its markings intact. It was a CY7C68013A (aka Cypress FX2LP).

The sensor used in the camera was still unknown, but the chips on the top board (with their markings scraped off) looked like eeprom chips, so I started to probe around there, and found the I2C clock and data lines on one of them, and could actually read out the firmware. Running strings on it didn't give any clues about the sensor. Probably can't post the firmware here, might be illegal...

Next step was to find the command bus used by the chip to talk to the sensor. I put a little thing I built on that buss, so I can inject my own I2C reads and writes. It looked like it would be a Micron (nowadays Aptina) sensor, since it responded on one adresses commonly used by them.

The final confirmation that it was a MT9T031 chip in that camera came when i read the 16 bit registers at adress 0 and 0xFF. They both responded with 0x1621, which matches the "chip version" according to their datasheet.

After checking on the linux-media mailing list that there was noone working on i driver, I started reverse engineering the protocol used by the windows software. It was quite easy with a USB snooping program under windows to figure out how it all was connected. Change one setting the the windows program, make a new snoop, and repeat until all options had been exercised.

The end result was a linux userspace application (using libusb and SDL) to view the video stream under linux. This should make it possible to use the camer I bought, and possibly the other cameras listed in the user interface of the windows program (they might all share the same VID:PID, just having different max resolutions).

It might support these Chinese industrial cameras: DLC130/130L, DLC131/131L, DLC200, DLC300, Whitehawk, Goldenhawk, and GoldenEagle. The Windows software lets you choose between those cameras at start up, and my camera produces images for all those choices. For some choices, the images are cropped, and/or in gray scale with visible bayer pattern (suggesting those cameras would be monochrome).

I've always intended to take a stab at writing a proper kernel driver for it, but havn't got time to do it yet. Those of you having to use that camera under linux could try to use the user space program instead, if all you care about is looking at, and taking images.

Download it here: dlc300-userspace-linux