Microdia USB 2.0 Webcam Drivers
===============================

This Driver is essentially a fork of the Syntek Webcam drivers for Linux by Nicolas,
specifically to accomodate Microdia chipset based Webcams.

Warning : 
The Microdia USB 2.0 Webcam Drivers for Microdia chipset based Webcams is currently under development.
Using this driver can result in damage. Use this driver only if you know what you are doing.

---------------------------------------------------------------------------------------------------

Table of contents :

1. Requirements

2. Compilation
 2.1 Documentation
 2.2 Kernel module

3. Installation

4. Usage
 4.1 Option "fps" module
 4.2 Options "hflip" and "vflip" module
 4.3 Options "contrast", "colour", "whiteness" and "brightness"
 4.4 Use the "sysfs"

5. Status of project

6. Test experimental

7. Debug
 7.1. 'lsusb' output
 7.2. USB logs from Windows
 7.3. USB logs from Linux
 7.4. Enable module traces

8. Licence

---------------------------------------------------------------------------------------------------

1. Requirements

Kernel 2.6.18 or higher
Doxygen in order to compile the documentation

---------------------------------------------------------------------------------------------------

2. Compilation

 2.1 Documentation

   To build documentation :
   $ make doc
   $ make cleandoc

 2.2 Kernel module

   To build the kernel module :
   $ make
     or
   $ make driver

   $ make clean

---------------------------------------------------------------------------------------------------

3. Installation

TODO...

---------------------------------------------------------------------------------------------------

4. Usage

 4.1 Option "fps" module

   The microdia module waits the option "fps" (10, 15, 20, 25, 30) :
   $ modprobe microdia fps=30

   By default, the fps is set to '25'.

 4.2 Options "hflip" and "vflip" module

   The microdia module waits the options "hflip" and "vflip" (values are 0 or 1):
   $ modprobe microdia hflip=0 vflip=1

   By default, the hflip and vflip are set to '1'.

 4.3 Options "contrast", "colour", "brightness" and "whiteness"

   The microdia module waits the options "contrast", "colour", "brightness" and "whiteness" :
   $ modprobe microdia contrast=0x7F00 colour=0x7F00

   By default, the value of these options is set to '0x7F00'.

 4.4 Use the "sysfs"

   In the directory : /sys/class/video4linux/videoX (by sample video0), you
   can read and write some parameters :
   $ cat hflip
   $ echo 0 > hflip

   To display informations about driver :
   $ cat informations

	 It is a register editor implemented. You can display and change the camera registers.
	 To use this register editor see follow examples below: 

	 0) open a shell and move to your video device (normaly video0)
	  $ cd /sys/class/video4linux/video0 

	 1) Set and display register adress 0x11b8 
	  $ echo 11b8 > adr     // set the adress value to 0x11b8
	  $ cat adr             // command to display the adress value
	  $ 0x11b8              // output

	 2) display the value from register 0x11b8 
	  $ cat reg             // command to display the register value
	  $ 0x11b8 = 0x3a       // output

	 3) Set value from register 0x11b8 to 0x10 
	  $ echo 10 > reg 


	 I2C Interface:

	 4) I2C Interface: set read/write count, 
	    (how many bytes we want to read/write = 1/2) 
			(we are using the adr value for this)

		$ echo 1 > adr        // we want only to read / write one byte 

	 5) I2C Interface: set i2c slave to 0x30 
	  $ echo 30 > i2cslave  // set the I2c slave adress to 0x30
	  $ cat i2cslave        // command to display the I2cadress value
	  $ 0x30                // output

	 6) I2C Interface: set i2c adress to 0x12 
	  $ echo 12 > i2cadr    // set the I2cadress value to 0x12
	  $ cat i2cadr          // command to display the I2cadress value
	  $ 0x12                // output

	 7) I2C Interface: Display I2c-register 0x12 (0x22 isn't valid, count is (1)) 
	  $ cat i2creg          // command to display the I2c register value
	  $ I2C-register 0x12 = 0x40 0x22 (1) 

	 8) I2C Interface: Set I2c-register
	 (you have to enter the values for 2 registers)
	 
	  $ echo 4100 > i2creg  // set the I2c register value to 0x41
	  $ cat i2creg          // command to display the I2c register value
	  $ I2C-register 0x12 = 0x41 0x22 (1) 




---------------------------------------------------------------------------------------------------

5. Status

The kernel module is currently under active development.

The driver supports following webcam models :
- 0x0c45:0x6242 :
- 0x0c45:0x624e :
- 0x0c45:0x624f :
- 0x0c45:0x6260 :
- 0x0c45:0x6270 :
- 0x0c45:0x627b :
- 0x0c45:0x6288 :
- 0x0c45:0x6128 :

To request support, please contact us on Microdia Mailing List:

    http://groups.google.com/group/microdia

---------------------------------------------------------------------------------------------------

6. Test experimental

To build and load the driver, follow the steps :

$ make -f Makefile clean
$ make -f Makefile
$ modprobe videodev
$ insmod microdia.ko

To test the driver with the V4L v1 API (map methode) :

$ camorama -D --width=640 --height=480 

To test the driver with the V4L v1 API (read methode) :

$ camorama -D -R --width=640 --height=480 

To test the driver with the V4L v2 :

$ xawtv

To use mplayer / mencoder :

$ mplayer tv:// -tv driver=v4l:width=640:height=480
$ mplayer tv:// -tv driver=v4l2:width=320:height=240:fps=25:outfmt=rgb24:device=/dev/video0
$ mplayer tv:// -tv driver=v4l2:width=320:height=240:fps=25:outfmt=yuy2:device=/dev/video0
$ mplayer tv:// -tv driver=v4l2:width=320:height=240:fps=25:outfmt=uyvy:device=/dev/video0

$ mencoder tv:// -tv driver=v4l:width=640:height=480:outfmt=rgb24:device=/dev/video0 -nosound -ovc lavc -o out.avi
$ mencoder tv:// -tv driver=v4l2:width=320:height=240:fps=25:outfmt=rgb24:device=/dev/video0 -nosound -ovc lavc -o out.avi

---------------------------------------------------------------------------------------------------

7. Debug

 7.1. 'lsusb' output

   [root@Dahlia driver]$ lsusb
   Bus 005 Device 003: ID 0c45:624f Microdia			<== Our Webcam 
   Bus 005 Device 001: ID 0000:0000  
   Bus 004 Device 001: ID 0000:0000  
   Bus 003 Device 002: ID 08ff:2580 AuthenTec, Inc. 
   Bus 003 Device 001: ID 0000:0000  
   Bus 002 Device 001: ID 0000:0000  
   Bus 001 Device 004: ID 0a5c:2101 Broadcom Corp. 
   Bus 001 Device 001: ID 0000:0000  
 
   [root@Dahlia driver]$ lsusb -d 0c45:624f -vvv > lsusb.txt

 7.2. USB logs from Windows
   There are 3 useful USB logs :
   - Log 1 : when you plug your webcam
   - Log 2 : when you run VideoView.exe (with the default settings)
   - Log 3 : when you run VideoView.exe, then change the resolution to 1280x1024

 7.3. USB logs from Linux
   Use the kernel module usbmon (enable option debugfs in the kernel)

 7.4. Enable module traces
   You can enable : CONFIG_MICRODIA_DEBUG and CONFIG_MICRODIA_DEBUG_STREAM

---------------------------------------------------------------------------------------------------

8. Licence

Microdia USB 2.0 Webcam Driver is distributed under the GPL licence (version 2 or later).

