Projects

Ricoh R5U870 Webcam Driver for Linux


Download Version 0.10.0, released 2007/4/7.

Download Ubuntu prebuilt binary packages from Arakhne

Download a DKMS package for Fedora 6, thanks to Naresh Kumar. What is a DKMS package?

If you have a Sony VAIO laptop or an HP Pavilion laptop, and primarily use Linux on it ... first of all, you're a freak. Second, you might have a little dot of a webcam above the screen -- that works fine in Windows -- giving you a blank stare.

The devices of interest are custom OEM built-in webcams based on the Ricoh R5U870 USB webcam controller chip or something very similar. They report USB vendor ID 0x05CA, and may or may not report UVC interface descriptors. The Windows device drivers are named Mvc25u870.sys, 5U870CAP.sys, and newer UVC model filter drivers are named R5U870FLx86.sys.

Devices known to fit this description include:

Device ID Description Support
05ca:1830 Sony VAIO SZ webcam, found in certain VAIO SZ machines that shipped with Windows XP.
Known as "Sony Visual Communication Camera VGP-VCC2"
Yes
05ca:1832 Sony VAIO UX webcam
Known as "Sony Visual Communication Camera VGP-VCC3"
This webcam apparently has two image sensors, although it can only use one sensor at a time. Information about the mechanism for selecting the active image sensor has not been collected, the Windows kernel driver for this camera does not appear to handle this function, and support for choosing between the image sensors is not present.
Yes
05ca:1833 Sony VAIO AR webcam, found in certain VAIO AR machines that shipped with Windows XP.
Known as "Sony Visual Communication Camera VGP-VCC2"
Thanks to Steve Wood for pointing out this device and sending a sniffusb trace.
Yes
05ca:1834 Sony VAIO AR webcam, found in certain VAIO AR machines that shipped with Windows XP.
Known as "Sony Visual Communication Camera VGP-VCC2"
Support for this device exists thanks to Benoît Canet, who independently reverse engineered the Windows driver for this camera and submitted appropriate patches.
Yes
05ca:1835 Sony VAIO SZ webcam, found in certain VAIO SZ machines that shipped with Windows Vista.
Known as "Sony Visual Communication Camera VGP-VCC5"
This device is UVC compliant, although it must still have its microcode file uploaded before it can be used, and has a number of picture controls that are not reported through the UVC descriptor table.
Yes
05ca:1836 Sony VAIO webcam, found in certain VAIO FE and VAIO AR machines that shipped with Windows Vista.
Known as "Sony Visual Communication Camera VGP-VCC4"
This device is similar to the above 1835 device, but requires a different microcode file.
Yes
05ca:1870 HP Pavilion built-in webcam
There are two distinct models with the same device IDs:

  1. "HP Webcam 1000" with VGA resolution
    This webcam appears to be present on HP Pavilion dv1000 series machines only.
  2. "HP Pavilion Webcam" with 1.3MP resolution
    This webcam appears to be present on HP Pavilion machines other than dv1000 series.

Both devices are supported by the current version of the driver.

Yes
05ca:1810 HP Pavilion built-in webcam (UVC, 1.3MP resolution)
Known as "HP Pavilion Webcam"
This device is very similar to the above 05ca:1870 "HP Pavilion Webcam" device, but partly complies with the UVC driver model.

A firmware upgrade is available from HP for the non-dv1000 05ca:1870 device, as part of their Windows Vista migration package, which converts that 05ca:1870 device into an 05ca:1810 device. The entire upgrade process appears to rewrite the USB descriptor table present on the device, and nothing else.

Yes

Help! My webcam is unsupported.

Adding support for devices that are listed as unsupported can be as simple as tracing USB activity of the Windows driver, and providing a good description of the Windows camera controls page. If you have a webcam listed on this page as unsupported, or maybe one that isn't listed on this page but should be, send me some mail at sam.revitch (at) gmail.com.

Driver Details

This driver supports all of the image formats and controls available with the Windows driver. It implements the Video4Linux 2 API, with consideration for V4L1 backward compatibility. It supports all frame buffer access methods specified by the V4L2 API, thanks to the video-buf module.

Applications Tested and Found to Work or Mostly Work

  • xawtv -- the canonical video4linux test application
  • Ekiga softphone.
  • camstream version 0.27. Version 0.26.3 does not work due to YUYV bugs.
  • Kopete instant messenger, although version 0.12 decodes color incorrectly and presents non-working video controls.
  • aMSN instant messenger
  • effectv real-time video effects
  • Motion motion-detection and security

Applications That Do Not Work

As a warning, most of these applications do not work due to lack of support for the YUYV or UYVY pixel formats, or simple related application bugs.

  • Camorama 0.18. This application does not understand YUYV or UYVY pixel formats, and will display a distorted image. A patch has been sent to the author.
  • Wengophone 2.0. This application has trivial problems with its pixertool library that prevent it from recognizing the YUYV pixel format. Wengophone 2.1 will include a fix for this problem, and will correctly capture and display frames in most cases. Unfortunately, Wengophone 2.1's V4L input handler implements the minimum possible functionality and that app still has a few problems. It does not specifically request pixel formats that it understands, and if the last app to open the webcam configured UYVY, Wengophone won't work. Wengophone 2.1 also limits frame rates by not maintaining continuous capture and will cause the capture LED to blink erratically.

Notes

This driver is extremely unlikely to work with kernels prior to 2.6.17.

This driver could have been implemented in a way to use the usbvideo driver framework present in the Linux kernel. Instead, I ended up writing a new webcam driver abstraction library that is functionally similar to usbvideo but does away with a number of design problems present in usbvideo.

How This Driver Was Produced

Examining the Mvc25u870.sys driver shipped with my Sony VAIO SZ laptop, according to the version information, the copyright belongs to a company called Micro Vision. As others have pointed out, this company advertises a similarly named device on their web site called M25U870, a USB 2.0 camera controller chip. They mention that the device is based on an Intel 80C51 type microcontroller, they describe the types of image sensors it is compatible with, and say that the data sheet is only available under an NDA. Charming.

As for Ricoh, many have pointed out a list of USB 2.0 Video Interface parts advertised on their site. They seem to offer an R5U870 USB 2.0 camera controller chip, which sounds remarkably similar to the Micro Vision M25U870. They also offer two complete webcam modules. It is unclear whether any of these exact modules were used as the actual OEM webcams, and in fact the webcam in my Sony VAIO could not possibly be as thick as Ricoh describes either of their modules. Anyway, these generic Ricoh webcam modules are described as being either UVC, or "supported by the Ricoh Original Driver."

There is also a series of more recently released drivers, which are named 5U870CAP.sys. These drivers actually claim to be copyright Ricoh. This style of driver can be found for both the HP webcam and the Sony VAIO AR webcam.

Similarities with Cypress EZ-USB type devices might be noted. However, the R5U870 clearly cannot be used with the same firmware loading mechanisms as EZ-USB devices.

Windows Drivers Compared

A brief inventory of Windows drivers that I've examined for Ricoh webcams is below.

Alias Shipped With File Name Version Date Size
Sony1 VAIO SZ360 Mvc25u870.sys 1.0.2.9 2005/12/28 55,680
HP1 Pavilion dv1669ea Mvc25u870.sys 1.0.1.7 2006/1/13 51,584
Sony2 VAIO UX50 Mvc25u870.sys 1.6.202.0 2006/5/19 59,392
HP2 Pavilion dv6146eu 5U870CAP.sys 1.1.100.0 2006/06/07 61,952
Sony3 VAIO AR290 5U870CAP.sys 1.1.204.0 2006/6/30 75,264

Each of these can be downloaded from the various OEM customer support sites, although most have click-through licenses.

To break it down, these drivers are very similar, and those of the same file name are similar in their machine code and organization to the point that specific functions can be compared. All of them:

  • Contain a microcode blob, which is discussed in more detail below.
  • Use the same core USB command set.
  • Use the same end-of-frame detection method.
  • Use a core set of registry values to configure which controls are available.

Each driver contains a different microcode blob. The blob is stored in some internal format. The drivers named Mvc25u870.sys all use what can be referred to as format A, and the drivers named 5U870CAP.sys all use format B.

Specific differences include:

  • Each driver's microcode blob is different.
  • The internal storage format of microcode blobs is the same between drivers of the same file name, but different between all Mvc25u870.sys drivers and all 5U870CAP.sys drivers.
  • The drivers named Mvc25u870.sys all seem to be derived from a near common ancestor code base. The drivers named 5U870CAP.sys also seem to be derived from a near common ancestor code base, but that ancestor seems like a clean-up or rewrite of the Mvc25u870.sys ancestor.
  • The HP drivers understand registry options for ColorEnable
  • The Sony drivers all understand registry options for Backlight_Compensation
  • The .INF files contain initial, default, and enablement values for each control, and none are identical.
  • The HP1 driver understands a registry option call First_InstallEnableEx, which causes it to send command 0xA6 on probe after checking the microcode state.
  • The HP2 driver instead uses command 0xA3 to presumably query the microcode version directly from the camera.

Microcode

All of these OEM webcams require microcode blobs in order to operate, and all seem to store the microcode blobs in volatile memory. The microcode must be loaded the first time the device is probed after a power cycle. Despite this, after losing power, all devices are able to provide USB descriptor tables, support the microcode upload commands, and gracefully recover from having invalid microcode uploaded.

As an unplanned experiment, some folks took my driver with its Sony1 microcode, and tried altering the device IDs so that it would initialize their HP webcam. This was an interesting experiment, because they reported that the HP webcam functioned in every way except that all isochronous data packets returned were empty, and thus the capture application would "hang" waiting for frames to complete.

This XX5U870 chip appears to be yet another webcam building block. Image sensors can be mixed and matched, but there must be corresponding microcode to support each image sensor. In this case, the Sony and HP webcams contain different image sensors.

UVC Devices

Newer R5U870 based webcams report proper UVC descriptor tables, and behave as genuine UVC compliant devices. These cameras can even be used with a generic UVC driver such as linux-uvc. However, they cannot function until their microcode has been uploaded, and uvcvideo will fail to initialize the device unless the microcode was previously uploaded by some external entity, e.g. the Windows driver.

Aside from microcode problems, these devices cannot be completely controlled by a generic UVC driver, as they do not expose all of their picture controls through UVC interfaces.

The Windows driver for Ricoh UVC cameras is the Microsoft-provided usbvideo.sys generic UVC driver, plus a pair of filter drivers. The R5U870FUx86.sys is attached above uvcvideo.sys. I'm not quite sure exactly what this driver does. The R5U870FLx86.sys is attached below usbvideo.sys, between it and the USB bus drivers. This driver is responsible for uploading microcode, and sending vendor commands for certain picture controls that are not exposed through UVC interfaces.

Acknowledgements

Thanks to Albert Vilella for establishing an interest group for this type of webcam, for early VAIO SZ testing, and generally collecting a good set of resources for Linux on VAIO SZ laptops.

Thanks to Geert Willems for extensive testing of HP Webcam support, general driver compatibility testing, and putting up with endless crazy requests for more debug information. :-)

Thanks to Mattia Dongili for taking usbsnoop traces of the VAIO UX50 webcam driver on Windows, and testing initial support in the Linux driver.

Thanks to Benoît Canet for support for the Sony VAIO AR webcam, device 05ca:1834. Benoît independently reverse engineered the Windows driver, extracted the microcode, and helped determine the control set.

Change Log

  • Version 0.9.1, 2007/3/21 - Fix build with 2.6.19 kernel, usbcam library update.
  • Version 0.9.0, 2007/3/6 - Major update, support three additional devices, restructure driver, fix at least one oops.
  • Version 0.8.1, 2007/2/15 - Fix build problems with kernel 2.6.18.
  • Version 0.8.0, 2007/2/14 - Initial public release

*  »

Crosstool for EZX


This is my tool for building a cross-compiler toolchain for Motorola A780/E680i EZX phones. It is an adaptation of Dan Kegel's crosstool system, with only the relevant portions extracted, and some custom patches added. It should produce a toolchain built from gcc-3.3.6/glibc-2.3.2/binutils-2.15. It can be compared to Leprechaun's E680 toolchain system, but offers improved floating point compatibility.

Current version: 0.6


*  »

Unofficial EZX Software Development Kit


This is my attempt at an unofficial SDK for Motorola EZX phones. This kit was created with the A780 in mind, but resulting applications reportedly work with E680i as well. It includes all required components from Trolltech Qt/Embedded 2.3.6 with appropriate patches applied, and a helloworld example program.

Current version: 0.2.0


*  »

USBMode for A780


USBMode can be used to change the mode of the USB port on a Motorola A780 cell phone. More so than a useful application, USBMode is meant to be a proof-of-concept that it is possible to create native GUI applications for this device without replacing the operating environment.


*  »

Drupal Image Publishing Module


This Drupal module allows certain 3rd party image publishing programs to interact with the image.module image galleries. Now version 0.2.


*  »

WordPress Migration Utility


This tool supports migration of a WordPress blog to Drupal. It was derived from code by Claudio Bustos < clbustos {at} apsique dot com >.


*  »