cloudice0102 发表于 2010-05-04 15:58

请教:懂v4l2的大侠请进来解惑

小弟想基于v4l2写一个摄像头的应用,但出现一个比较奇怪的问题:
在dev中可以找到video0节点且确实是我的摄像头关联的(我插起摄像头才出现的),但是用open打开的时候死活返回-1(出错),也就是说打开设备出错了,但不知道什么原因……
有个问题就是,我是用ssh从远程连到这台插了摄像头的机器上,然后执行它上面的应用程序(打开设备)的,这个应该没有关系吧?

snail_314 发表于 2010-05-05 12:33

dmesg?

cloudice0102 发表于 2010-05-05 16:28

[   33.713112] SCSI subsystem initialized
[   33.721227] ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver
[   33.721580] ACPI: PCI Interrupt Link enabled at IRQ 22
[   33.721589] ACPI: PCI Interrupt 0000:00:02.0 -> Link -> GSI 22 (level, low) -> IRQ 16
[   33.721601] PCI: Setting latency timer of device 0000:00:02.0 to 64
[   33.721604] ohci_hcd 0000:00:02.0: OHCI Host Controller
[   33.721832] ohci_hcd 0000:00:02.0: new USB bus registered, assigned bus number 1
[   33.721847] ohci_hcd 0000:00:02.0: irq 16, io mem 0xfe02f000
[   33.745376] libata version 3.00 loaded.
[   33.777641] usb usb1: configuration #1 chosen from 1 choice
[   33.777662] hub 1-0:1.0: USB hub found
[   33.777668] hub 1-0:1.0: 8 ports detected
[   33.879895] ACPI: PCI Interrupt Link enabled at IRQ 21
[   33.879905] ACPI: PCI Interrupt 0000:00:02.1 -> Link -> GSI 21 (level, low) -> IRQ 17
[   33.879916] PCI: Setting latency timer of device 0000:00:02.1 to 64
[   33.879919] ehci_hcd 0000:00:02.1: EHCI Host Controller
[   33.879939] ehci_hcd 0000:00:02.1: new USB bus registered, assigned bus number 2
[   33.879964] ehci_hcd 0000:00:02.1: debug port 1
[   33.879968] PCI: cache line size of 64 is not supported by device 0000:00:02.1
[   33.879977] ehci_hcd 0000:00:02.1: irq 17, io mem 0xfe02e000
[   33.891389] ehci_hcd 0000:00:02.1: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
[   33.891496] usb usb2: configuration #1 chosen from 1 choice
[   33.891519] hub 2-0:1.0: USB hub found
[   33.891524] hub 2-0:1.0: 8 ports detected
[   33.995408] forcedeth: Reverse Engineered nForce ethernet driver. Version 0.61.
[   33.995737] ACPI: PCI Interrupt Link enabled at IRQ 20
[   33.995746] ACPI: PCI Interrupt 0000:00:07.0 -> Link -> GSI 20 (level, low) -> IRQ 18
[   33.995751] PCI: Setting latency timer of device 0000:00:07.0 to 64
[   34.514969] forcedeth 0000:00:07.0: ifname eth0, PHY OUI 0x90c3 @ 9, addr 00:e0:4c:11:f8:d5
[   34.514974] forcedeth 0000:00:07.0: highdma pwrctl mgmt timirq lnktim msi desc-v3
[   34.515272] PCI: Setting latency timer of device 0000:00:06.0 to 64
[   34.515596] ACPI: PCI Interrupt Link enabled at IRQ 23
[   34.515605] ACPI: PCI Interrupt 0000:00:08.0 -> Link -> GSI 23 (level, low) -> IRQ 19
[   34.515621] PCI: Setting latency timer of device 0000:00:08.0 to 64
[   34.515628] ACPI: PCI interrupt for device 0000:00:08.0 disabled
[   34.515894] ACPI: PCI Interrupt Link enabled at IRQ 23
[   34.515896] ACPI: PCI Interrupt 0000:00:08.1 -> Link -> GSI 23 (level, low) -> IRQ 19
[   34.515911] PCI: Setting latency timer of device 0000:00:08.1 to 64
[   34.515918] ACPI: PCI interrupt for device 0000:00:08.1 disabled
[   34.517806] sata_nv 0000:00:08.0: version 3.5
[   34.517812] ACPI: PCI Interrupt 0000:00:08.0 -> Link -> GSI 23 (level, low) -> IRQ 19
[   34.517835] PCI: Setting latency timer of device 0000:00:08.0 to 64
[   34.518822] scsi0 : sata_nv
[   34.519275] scsi1 : sata_nv
[   34.519427] ata1: SATA max UDMA/133 cmd 0x9f0 ctl 0xbf0 bmdma 0xd800 irq 19
[   34.519430] ata2: SATA max UDMA/133 cmd 0x970 ctl 0xb70 bmdma 0xd808 irq 19
[   34.830135] ata1: SATA link down (SStatus 0 SControl 300)
[   35.149718] ata2: SATA link down (SStatus 0 SControl 300)
[   35.159972] ACPI: PCI Interrupt 0000:00:08.1 -> Link -> GSI 23 (level, low) -> IRQ 19
[   35.160010] PCI: Setting latency timer of device 0000:00:08.1 to 64
[   35.160047] scsi2 : sata_nv
[   35.160242] scsi3 : sata_nv
[   35.160383] ata3: SATA max UDMA/133 cmd 0x9e0 ctl 0xbe0 bmdma 0xc400 irq 19
[   35.160385] ata4: SATA max UDMA/133 cmd 0x960 ctl 0xb60 bmdma 0xc408 irq 19
[   35.205640] usb 1-1: new low speed USB device using ohci_hcd and address 2
[   35.432520] usb 1-1: configuration #1 chosen from 1 choice
[   35.469294] ata3: SATA link down (SStatus 0 SControl 300)
[   35.736945] usb 1-2: new low speed USB device using ohci_hcd and address 3
[   35.939882] usb 1-2: configuration #1 chosen from 1 choice
[   35.944688] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[   35.999684] ata4.00: ATA-7: ST3160815AS, 3.AAC, max UDMA/133
[   35.999688] ata4.00: 312581808 sectors, multi 16: LBA48 NCQ (depth 0/32)
[   36.066231] ata4.00: configured for UDMA/133
[   36.066332] scsi 3:0:0:0: Direct-Access   ATA      ST3160815AS      3.AA PQ: 0 ANSI: 5
[   36.070751] pata_amd 0000:00:06.0: version 0.3.10
[   36.070796] PCI: Setting latency timer of device 0000:00:06.0 to 64
[   36.073414] scsi4 : pata_amd
[   36.073713] scsi5 : pata_amd
[   36.074210] ata5: PATA max UDMA/133 cmd 0x1f0 ctl 0x3f6 bmdma 0xf000 irq 14
[   36.074212] ata6: PATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0xf008 irq 15
[   36.079263] Driver 'sd' needs updating - please use bus_type methods
[   36.079335] sd 3:0:0:0: 312581808 512-byte hardware sectors (160042 MB)
[   36.079346] sd 3:0:0:0: Write Protect is off
[   36.079348] sd 3:0:0:0: Mode Sense: 00 3a 00 00
[   36.079361] sd 3:0:0:0: Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   36.079398] sd 3:0:0:0: 312581808 512-byte hardware sectors (160042 MB)
[   36.079405] sd 3:0:0:0: Write Protect is off
[   36.079407] sd 3:0:0:0: Mode Sense: 00 3a 00 00
[   36.079418] sd 3:0:0:0: Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   36.079421]sda: sda1 sda2 sda3
[   36.114238] sd 3:0:0:0: Attached SCSI disk
[   36.118843] sd 3:0:0:0: Attached scsi generic sg0 type 0
[   36.244281] usb 1-3: new full speed USB device using ohci_hcd and address 4
[   36.244853] ata5.00: ATA-6: HDS722580VLAT20, V32OA60A, max UDMA/100
[   36.244856] ata5.00: 160836480 sectors, multi 16: LBA48
[   36.268733] ata5.00: configured for UDMA/100
[   36.268768] ata6: port disabled. ignoring.
[   36.268872] scsi 4:0:0:0: Direct-Access   ATA      HDS722580VLAT20V32O PQ: 0 ANSI: 5
[   36.269132] sd 4:0:0:0: 160836480 512-byte hardware sectors (82348 MB)
[   36.269143] sd 4:0:0:0: Write Protect is off
[   36.269145] sd 4:0:0:0: Mode Sense: 00 3a 00 00
[   36.269159] sd 4:0:0:0: Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   36.269195] sd 4:0:0:0: 160836480 512-byte hardware sectors (82348 MB)
[   36.269203] sd 4:0:0:0: Write Protect is off
[   36.269205] sd 4:0:0:0: Mode Sense: 00 3a 00 00
[   36.269217] sd 4:0:0:0: Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   36.269221]sdb: sdb1 sdb2 sdb3 sdb4
[   36.286542] sd 4:0:0:0: Attached SCSI disk
[   36.286569] sd 4:0:0:0: Attached scsi generic sg1 type 0
[   36.453230] usb 1-3: configuration #1 chosen from 1 choice
[   36.456273] usbcore: registered new interface driver hiddev
[   36.468315] input:   USB Keyboard as /devices/pci0000:00/0000:00:02.0/usb1/1-1/1-1:1.0/input/input1
[   36.480003] input,hidraw0: USB HID v1.10 Keyboard on usb-0000:00:02.0-1
[   36.501799] input:   USB Keyboard as /devices/pci0000:00/0000:00:02.0/usb1/1-1/1-1:1.1/input/input2
[   36.511937] input,hidraw1: USB HID v1.10 Device on usb-0000:00:02.0-1
[   36.517211] input: HID 062a:0001 as /devices/pci0000:00/0000:00:02.0/usb1/1-2/1-2:1.0/input/input3
[   36.531925] input,hidraw2: USB HID v1.10 Mouse on usb-0000:00:02.0-2
[   36.531942] usbcore: registered new interface driver usbhid
[   36.531945] /build/buildd/linux-2.6.24/drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
[   36.638043] Attempting manual resume
[   36.638047] swsusp: Resume From Partition 8:19
[   36.638048] PM: Checking swsusp image.
[   36.638200] PM: Resume from disk failed.
[   36.649720] EXT3-fs: INFO: recovery required on readonly filesystem.
[   36.649724] EXT3-fs: write access will be enabled during recovery.
[   37.761557] kjournald starting.Commit interval 5 seconds
[   37.761571] EXT3-fs: sdb4: orphan cleanup on readonly fs
[   37.761576] ext3_orphan_cleanup: deleting unreferenced inode 1998931
[   37.761608] ext3_orphan_cleanup: deleting unreferenced inode 1114118
[   37.761615] ext3_orphan_cleanup: deleting unreferenced inode 1114117
[   37.761620] ext3_orphan_cleanup: deleting unreferenced inode 1114116
[   37.761625] ext3_orphan_cleanup: deleting unreferenced inode 1114115
[   37.761630] ext3_orphan_cleanup: deleting unreferenced inode 1114114
[   37.761634] EXT3-fs: sdb4: 6 orphan inodes deleted
[   37.761635] EXT3-fs: recovery complete.
[   37.771643] EXT3-fs: mounted filesystem with ordered data mode.
[   45.791815] i2c-adapter i2c-0: nForce2 SMBus adapter at 0x1c00
[   45.791838] i2c-adapter i2c-1: nForce2 SMBus adapter at 0xf400
[   46.306668] input: Power Button (FF) as /devices/virtual/input/input4
[   46.307944] udev: renamed network interface eth0 to eth1
[   46.319001] ACPI: Power Button (FF)
[   46.319103] input: Power Button (CM) as /devices/virtual/input/input5
[   46.334962] ACPI: Power Button (CM)
[   46.698522] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[   46.739034] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4
[   47.094362] ACPI: PCI Interrupt Link enabled at IRQ 22
[   47.094367] ACPI: PCI Interrupt 0000:00:05.0 -> Link -> GSI 22 (level, low) -> IRQ 16
[   47.094384] PCI: Setting latency timer of device 0000:00:05.0 to 64
[   47.128670] hda_codec: Unknown model for ALC662, trying auto-probe from BIOS...
[   47.525389] NET: Registered protocol family 10
[   47.525556] lo: Disabled Privacy Extensions
[   48.755787] Linux video capture interface: v2.00
[   48.807145] /build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c: USB GSPCA camera found. SONIX JPEG (sn9c1xx)
[   48.808553] usbcore: registered new interface driver gspca
[   48.808556] /build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c: gspca driver 01.00.20 registered
[   48.916215] sn9c102: V4L2 driver for SN9C1xx PC Camera Controllers v1:1.47
[   48.916282] usbcore: registered new interface driver sn9c102
[   49.107485] Linux agpgart interface v0.102
[   49.427011] input: PC Speaker as /devices/platform/pcspkr/input/input6
[   50.872505] lp: driver loaded but no devices found
[   51.021042] Adding 979956k swap on /dev/sdb3.Priority:-1 extents:1 across:979956k
[   51.570868] EXT3 FS on sdb4, internal journal
[   57.054167] kjournald starting.Commit interval 5 seconds
[   57.060904] EXT3 FS on sda1, internal journal
[   57.060908] EXT3-fs: mounted filesystem with ordered data mode.
[   57.092769] kjournald starting.Commit interval 5 seconds
[   57.092899] EXT3 FS on sda2, internal journal
[   57.092901] EXT3-fs: mounted filesystem with ordered data mode.
[   57.119465] kjournald starting.Commit interval 5 seconds
[   57.119590] EXT3 FS on sda3, internal journal
[   57.119593] EXT3-fs: mounted filesystem with ordered data mode.
[   57.512390] ip_tables: (C) 2000-2006 Netfilter Core Team
[   58.075461] eth1: no IPv6 routers present
[   58.936418] RPC: Registered udp transport module.
[   58.936422] RPC: Registered tcp transport module.
[   59.352198] No dock devices found.
[   59.688658] powernow-k8: Found 1 AMD Sempron(tm) Processor LE-1200 processors (1 cpu cores) (version 2.20.00)
[   59.694100] powernow-k8: BIOS error - no PSB or ACPI _PSS objects
[   62.320941] apm: BIOS version 1.2 Flags 0x07 (Driver version 1.16ac)
[   62.320945] apm: overridden by ACPI.
[   62.461843] ppdev: user-space parallel port driver
[   62.573363] audit(1272974082.845:2): type=1503 operation="inode_permission" requested_mask="a::" denied_mask="a::" name="/dev/tty" pid=5431 profile="/usr/sbin/cupsd" namespace="default"
[   63.759046] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[   63.834634] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
[   63.848432] NFSD: starting 90-second grace period
[   65.888812] /build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
[   65.891916] ohci_hcd 0000:00:02.0: leak ed df91c140 (#81) state 2
[   66.906959] Bluetooth: Core ver 2.11
[   66.907438] NET: Registered protocol family 31
[   66.907442] Bluetooth: HCI device and connection manager initialized
[   66.907445] Bluetooth: HCI socket layer initialized
[   66.935838] Bluetooth: L2CAP ver 2.9
[   66.935843] Bluetooth: L2CAP socket layer initialized
[   66.973209] Bluetooth: RFCOMM socket layer initialized
[   66.973409] Bluetooth: RFCOMM TTY layer initialized
[   66.973411] Bluetooth: RFCOMM ver 1.8
/build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
ohci_hcd 0000:00:02.0: leak ed df91c1c0 (#81) state 2
/build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
……
usb 1-1: new full speed USB device using ohci_hcd and address 14
usb 1-1: configuration #1 chosen from 1 choice
/build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c: USB GSPCA camera found. SONIX JPEG (sn9c1xx)
/build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
ohci_hcd 0000:00:02.0: leak ed df91c300 (#81) state 2


上面是开机后的信息,有gspca的错误,但是后来不知道是因为我换了个usb口还是因为我把摄像头驱动模块rmmod后重新insmod了,重新插摄像头后错误信息没了,可有时候又有
我想这个驱动对我的摄像头支持可能还是有点问题
我现在用的摄像头是CNLTF的,好像叫什么尤佳的摄像头,但是驱动显示识别成了sn9c1xx的嘛~~
请大侠指教,谢谢

cloudice0102 发表于 2010-05-05 16:29

说明一下,我用的是Ubuntu9.10,摄像头驱动是系统自带的,所以我还没有重新编译驱动去跟踪错误信息~因为不确定是什么问题

snail_314 发表于 2010-05-05 16:46

"但是驱动显示识别成了sn9c1xx的嘛"

应该所有的摄像头采集芯片都是用的中芯微的chip,就是这款driver。

我的意思是说你open失败后再dmesg | grep error之类的,不是看开机后的dmesg

cloudice0102 发表于 2010-05-05 18:45

open失败后是没有消息显示的
上面贴出的dmesg就是开机然后执行过N次open后的消息
只有把摄像头拔了重插才会出现这个消息:
/build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c: USB GSPCA camera found. SONIX JPEG (sn9c1xx)
/build/buildd/linux-ubuntu-modules-2.6.24-2.6.24/debian/build/build-generic/media/gspcav1/gspca_core.c: init isoc: usb_submit_urb(0) ret -28
ohci_hcd 0000:00:02.0: leak ed df91c300 (#81) state 2
页: [1]
查看完整版本: 请教:懂v4l2的大侠请进来解惑