全部博文(489)
分类:
2012-01-12 13:42:26
原文地址:使gspca支持自己的USB摄像头 作者:aaronwong0207
#uname -r 2.6.20-1.2962.fc6 #arch i686 #wget devel-2.6.20-1.2962.fc6.i686.rpm #rpm -ivh kernel-devel-2.6.20-1.2962.fc6.i686.rpm |
#wget 20070508.tar.gz #tar xfv gspcav1-20070508.tar.gz #cd gspcav1-20070508 #./gspca_build |
#lsusb Bus 002 Device 001: ID 0000:0000 Bus 002 Device 003: ID 046d:08af Logitech, Inc. Bus 001 Device 001: ID 0000:0000 Bus 004 Device 001: ID 0000:0000 Bus 003 Device 001: ID 0000:0000 |
#mknod /dev/video0 c 81 0 #ln -s /dev/video0 /dev/video |
#define VENDOR_LOGITECH 0x046d |
#define BRIDGE_ZC3XX 12 |
#define SENSOR_HV7131B 2 #define SENSOR_HDCS2020 9 #define SENSOR_HV7131C 12 #define SENSOR_HV7131R 15 #define SENSOR_PAS202 19 #define SENSOR_TAS5130C_VF0250 22 |
Camera Type |
Product ID |
Bridge DSP |
Sensor |
Comments(sensor in driver code) |
QC IM |
08a0 |
zc030x |
HDCS2020 |
TAS5130C(08a0/a1/a3,08d9/da) |
QC IM |
08a6 |
zc030x |
HV7131R |
HV7131C (08a6/ad, 08d7) |
NoteBook Deluxe |
08a9 |
zc0302 |
HV7131B |
HDCS2020 (08a2/a9/ae, 08d8) |
QC Image |
08a7 |
zc030x |
PAS202 |
|
QC for Notebook |
08ae |
zc030x |
PAS202 |
HDCS2020 |
QC Cool |
08ac |
zc030x |
PAS202 |
HV7131B |
Communicate STX |
08ad |
zc0302 |
TAS5130C |
HV7131C |
Communicate STX |
08d7 |
vc0302/zc0302 |
TAS5130C |
HV7131C |
QC IM/Connect |
08d9 |
zc030x |
TAS5130C |
|
QC Messenger |
08da |
zc030x |
TAS5130C |
|
NoteBook Deluxe |
08d8 |
vc0302/zc0302 |
TAS5130C |
|
QC Easy/Cool |
08af |
?(zc030x) |
? |
(HV7131C/HV7131B/TAS5130C/HDCS2020) |
enum { UnknownCamera = 0, // 0 IntelPCCameraPro, IntelCreateAndShare, ...... PhilipsDMVC1300K, LogitechQC_EasyCool, // added by aaron LastCamera }; static struct cam_list clist[] = { {UnknownCamera, "Unknown"}, {IntelPCCameraPro, "Intel PC Camera Pro"}, {IntelCreateAndShare, "Intel Create and Share"}, ...... {PhilipsDMVC1300K,"Philips DMVC 1300K"}, {LogitechQC_EasyCool,"Logitech QuickCam Easy_Cool"}, //added by aaron {-1, NULL} }; static __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x0733, 0x0430)}, /*Intel PC Camera Pro*/ {USB_DEVICE(0x0733, 0x0401)}, /* Intel Create and Share */ ...... {USB_DEVICE(0x0471, 0x0322)}, /* Philips DMVC1300K */ {USB_DEVICE(0x046d, 0x08af)}, /* Logitech QuickCam Easy_Cool, added by aaron */ {USB_DEVICE(0x0000, 0x0000)}, /* MystFromOri Unknow Camera */ {} /* Terminating entry */ }; static int gspca_attach_bridge(struct usb_spca50x *spca50x) { /* set the default epadr */ spca50x->epadr =1; switch (spca50x->bridge) { ...... case BRIDGE_ZC3XX: spca50x->cameratype = JPGH; info("USB GSPCA camera found.(ZC3XX) "); memcpy(&spca50x->funct, &fzc3xx, sizeof (struct cam_operation)); break; ...... //other DSP bridges default: return -ENODEV; } return 0; } |
static int spcaDetectCamera(struct usb_spca50x *spca50x) { struct usb_device *dev = spca50x->dev; __u8 fw = 0; __u16 vendor; __u16 product; /* Is it a recognised camera ? */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) vendor = le16_to_cpu(dev->descriptor.idVendor); product = le16_to_cpu(dev->descriptor.idProduct); #else vendor = dev->descriptor.idVendor; product = dev->descriptor.idProduct; #endif switch (vendor) { case 0x046d: /* Logitech Labtec */ switch (product) { case 0x08af: //added by aaron spca50x->desc = LogitechQC_EasyCool; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_HV7131B; break; ...... case 0x08a0: spca50x->desc = QCim; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_TAS5130CXX; break; case 0x08a1: spca50x->desc = QCimA1; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_TAS5130CXX; break; case 0x08a2: // zc302 chips spca50x->desc = LabtecPro; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_HDCS2020; break; case 0x08a3: spca50x->desc = QCchat; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_TAS5130CXX; break; case 0x08a6: spca50x->desc = LogitechQCim; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_HV7131C; break; case 0x08a7: spca50x->desc = LogitechQCImage; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_PAS202; break; case 0x08d8: case 0x08a9: spca50x->desc = LogitechNotebookDeluxe; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_HDCS2020; break; case 0x08ae: spca50x->desc = QuickCamNB; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_HDCS2020; break; case 0x08ac: spca50x->desc = LogitechQCCool; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_HV7131B; break; ...... default: goto error; }; break; ...... //other vendors return gspca_attach_bridge(spca50x); error: return -ENODEV; //no camera match } static int spca5xx_probe(struct usb_interface *intf, const struct usb_device_id *id){ ...... if ((err_probe = spcaDetectCamera(spca50x)) < 0) { err(" Devices not found !! "); goto error; } ...... } |
#rm -f /dev/video* //删除旧的自己创建的设备节点 #modprobe -rv gspca #make uninstall #make clean #./gspca_build #ls /dev/video* lrwxrwxrwx 1 root root 6 09-22 21:44 /dev/video->video0 crw------- 1 aaronwong root 81, 0 09-22 21:42 /dev/video0 |
$spcagui SpcaGui version: 0.3.5 date: 18 September 2005 video device /dev/video0 Camera found: Logitech QuickCam Easy_Cool VIDIOCGPICT brightnes=32768 hue=0 color=0 contrast=32768 whiteness=0depth=24 palette=4 Bridge found: ZC301-2 Unable to find a StreamId !! StreamId: 6 Unknow Camera try palette 15 depth 12 Available palette 15 try palette 3 depth 16 Available palette 3 try palette 4 depth 24 Available palette 4 try palette 5 depth 32 Available palette 5 probe size in Available Resolutions width 640 heigth 480 Available Resolutions width 384 heigth 288 Available Resolutions width 352 heigth 288 Available Resolutions width 320 heigth 240 Available Resolutions width 192 heigth 144 Available Resolutions width 176 heigth 144 grabbing method default MMAP asked VIDIOCGMBUF size 2457616 frames 2 offets[0]=0 offsets[1]=1228808 ...... |
#modprobe -v gspca insmod /lib/modules/2.6.20-1.2962.fc6/kernel/drivers/media/video/v4l1-compat.ko insmod /lib/modules/2.6.20-1.2962.fc6/kernel/drivers/media/video/v4l2-common.ko insmod /lib/modules/2.6.20-1.2962.fc6/kernel/drivers/media/video/videodev.ko insmod /lib/modules/2.6.20-1.2962.fc6/kernel/drivers/usb/media/gspca.ko #dmesg | grep gspca /home/aaronwong/webcam/driver/gspcav1-20070508/gspca_core.c: USB GSPCA camera found.(ZC3XX) /home/aaronwong/webcam/driver/gspcav1-20070508/gspca_core.c: [spca5xx_probe:4109] Camera type JPEG /home/aaronwong/webcam/driver/gspcav1-20070508/Vimicro/zc3xx.h: [zc3xx_config:515] Sensor ID:2 /home/aaronwong/webcam/driver/gspcav1-20070508/Vimicro/zc3xx.h: [zc3xx_config:597] Find Sensor HV7131R(c) /home/aaronwong/webcam/driver/gspcav1-20070508/gspca_core.c: [spca5xx_getcapability:1218] maxw 640 maxh 480 minw 176 minh 144 usbcore: registered new interface driver gspca /home/aaronwong/webcam/driver/gspcav1-20070508/gspca_core.c: gspca driver 01.00.18 registered |
case 0x08af: //added by aaron spca50x->desc = LogitechQC_EasyCool; spca50x->bridge = BRIDGE_ZC3XX; spca50x->sensor = SENSOR_HV7131R; //SENSOR_HV7131C; break; |