Which driver is handling my IOCTL - linux-kernel

I am opening a socket like this:
skfd = socket( AF_INET, SOCK_DGRAM, 0 );
and then doing an ioctl on skfd like: ioctl(skfd, SIOCETHTOOL, &ifr)
I want to know which driver is handling this IOCTL in my kernel.
I know that had it been a character driver, I could have looked up for the major number of the file I am opening and then do a cat /proc/devices to find which driver is registered with that major number.
Must be some similar way here.

The fish
You are calling ioctl on a filedescriptor that is representing socket. If you examine net/socket.c file, you will find socket_file_ops structure that defines sock_ioctl as a ioctl callback. For SIOCETHTOOL, this function will call sock_do_ioctl which in turn (after checking that this particular socket type (AF_INET - af_inet.c, inet_ioctl function) does not handle this ioctl by itself) will call dev_ioctl which can handle SIOCETHTOOL by calling dev_ethtool. If your driver defines ethtool_ops, this should be supported.
Now finding which device driver supports your network interface is another thing but this isn't really hard. One way to do this is to use sysfs, just check what is this symlink pointing to (substituting eth0 with your interface name):
readlink /sys/class/net/eth0/device/driver/module
../../../../module/e1000e
So my ethernet card is driven by module e1000e.
The fishing rod
Now I found this out by reading the code. I do know something about kernel code so I knew where I should look. If I wouldn't, however, there's other way to find this out - tracing. Now I'm not sure if all this works on 2.6.32, but at least I tested this on kernel 3.2 (which isn't that much different). I won't go into details on how to configure your kernel to have all those functionalities. Ubuntu 12.04 has all that is needed and if you're interested google for ftrace:
You need debugfs mounted and a script like this:
#!/bin/sh
DEBUGFS=`/sys/kernel/debug/`
echo $$ > $DEBUGFS/tracing/set_ftrace_pid
echo function > $DEBUGFS/tracing/current_tracer
exec $*
This script will set ftrace to only care about current PID, enable function tracer and exec the command specified as an argument (without forking as that would change the PID).
Now, if your application that is using this ioctl is /tmp/a.out, you can call:
~/bin/ftraceme.sh /tmp/a.out
echo -n "" > /sys/kernel/debug/tracing/current_tracer
grep ioctl /sys/kernel/debug/tracing/trace
In my case, I've got:
<...>-11009 [007] 596251.750675: sys_ioctl <-system_call_fastpath (1)
<...>-11009 [007] 596251.750675: fget_light <-sys_ioctl
<...>-11009 [007] 596251.750675: security_file_ioctl <-sys_ioctl
<...>-11009 [007] 596251.750676: cap_file_ioctl <-security_file_ioctl
<...>-11009 [007] 596251.750676: do_vfs_ioctl <-sys_ioctl
<...>-11009 [007] 596251.750676: sock_ioctl <-do_vfs_ioctl (2)
<...>-11009 [007] 596251.750677: sock_do_ioctl <-sock_ioctl (3)
<...>-11009 [007] 596251.750677: inet_ioctl <-sock_do_ioctl (4)
<...>-11009 [007] 596251.750677: udp_ioctl <-inet_ioctl
<...>-11009 [007] 596251.750678: dev_ioctl <-sock_do_ioctl (5)
<...>-11009 [007] 596251.750678: _cond_resched <-dev_ioctl
<...>-11009 [007] 596251.750679: dev_load <-dev_ioctl
<...>-11009 [007] 596251.750680: rtnl_lock <-dev_ioctl
<...>-11009 [007] 596251.750680: dev_ethtool <-dev_ioctl (6)
<...>-11009 [007] 596251.750684: rtnl_unlock <-dev_ioctl
<...>-11009 [007] 596251.750685: _cond_resched <-dev_ioctl
Which proves what I wrote above.

Related

BeagleBone Black: how to activate UART 4 or 5 to enable RS-485 communication

I want to enable RS-485 AND CANbus communications for my BBB using the comms cape 2.
I used to setup my Beaglebone black thru the /boot/uEnv.txt by overwriting with EEProm as follows:
###Overide capes with eeprom
uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo
uboot_overlay_addr1=/lib/firmware/BB-UART2-00A0.dtbo
uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo
uboot_overlay_addr3=/lib/firmware/BB-UART5-00A0.dtbo
And then I use ttyS4 for RS-485 comms.
Though it used to work on some BBBs, it's no longer the case on many others and many issues raise:
If I do that, the CANbus stops to work - probably messing the UART for the CANbus;
If I do not use CANbus, this settings does not seem to work anymore for the RS-485 itself - I guess something changed that depends on the linux version installed.
Long story short, I'd like to find a modern way to 1) setup RS-485 comms and 2) setup CANbus comm so that they work simultaneously.
And, possibly, how can I test RS-485 comms work, independent of my own software?
What I found on the Web:
The official cape comms doc here https://github.com/beagleboard/capes/tree/master/beaglebone/Comms tells how to setup things as follows:
For the RS485, you just need
config-pin p9.11 uart
config-pin p9.13 uart
...and then use /dev/ttyS4
For the CAN, you just need
config-pin p9.24 can
config-pin p9.26 can
But in my case, setting config-pin p9.11 uart leads to the following error:
ERROR: open() for /sys/devices/platform/ocp/ocp:P9_11_pinmux/state failed, No such file or directory
This SO beaglebone black: no slots while enable uart tells how to setup UART5.
They say to disable video, which I did.
And to:
config-pin P8_37 uart
config-pin P8_38 uart
which works on my side, I mean no error was generated.
And then I used ttS5 in my own software, but I cannot see anything on the RS-485.
At this time I am a bit puzzled: for example, should I overwrite EEPROM or not? Should I stick with the disabling of video, sound, etc. Why config-pin for UART4 doesn't work? Does UART 5 correspond to ttyS5? And how to make sure the ttySX I use really work with the RS-485 comm?
Thanks in advance.
APPENDIX: my current /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.19.94-ti-r42
#uuid=
#dtb=
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U$
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo
#uboot_overlay_addr1=/lib/firmware/BB-UART2-00A0.dtbo
uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo
uboot_overlay_addr3=/lib/firmware/BB-UART5-00A0.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###
cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_qual$
#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_qua$
##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
Here is my /boot/uEnv.txt file:
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.19.94-ti-r71
#uuid=
#dtb=
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
uboot_overlay_addr0=BONE-SPI1_0.dtbo
uboot_overlay_addr1=BONE-SPI0_0.dtbo
#uboot_overlay_addr2=<file2>.dtbo
#uboot_overlay_addr3=<file3>.dtbo
I did not apply the /lib/firmware sections in my uboot-overlays section(s).
This is ls -l /dev/spidev*
crw------- 1 root root 153, 0 Feb 10 00:39 /dev/spidev1.0
crw------- 1 root root 153, 1 Feb 10 00:39 /dev/spidev2.0
I think not being root might be an issue for me.
Anyway...the symlinks are used in source these days, I think, and there is also an up-to-date repo. from the BeagleBoard.org fellows/gals that help one to produce their .dts files into .dtb/o files. It is useful to me b/c I can then alter things or see what the people at beagleboard.org are doing w/ DT.
Finally, What I have done to fix the issue is:
use ttyS4 for the RS-485;
use can1 for CANbus communications.
The /boot/uEnv.txt is very simple then, simply do not set any UART, keep it as default. Here it is:
$ cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.19.94-ti-r71
#uuid=
#dtb=
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo
#uboot_overlay_addr1=/lib/firmware/BB-UART2-00A0.dtbo
#uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo
#uboot_overlay_addr3=/lib/firmware/BB-UART5-00A0.dtbo
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
disable_uboot_overlay_wireless=1
disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=0
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###
cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet
#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768#60e
##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

usb Mass Storage driver for am335x

i want to loard a usb drive storage module so i make when i load usb mass storage module the usb drive detect in /media or /dev/sda1
I have one customized bord using an am335x processor and this board has one USB port(for USB drive connector) and one micro USB port. and also have kernel source code and version is 4.4.16 now i follow the command to compile kernel source code
make distclean CROSS_COMPILE=arm-linux-gnueabihf-
make am335x_fujitel_defconfig CROSS_COMPILE=arm-linux-gnueabihf-
note= am335x_fujitel_defconfig is my edited defconfig file according to my bord and after that type
make menuconfig
The reason is I want to make module of USB storage driver so i can install module first to connect my usb drive to the device
so i follow this link https://processors.wiki.ti.com/index.php/Usbgeneralpage#Mass_Storage_Gadget as reference
and changes some driver configurations.
I found that when i uncheck
< > Inventra Highspeed Dual Role Controller (TI, ADI, AW, ...)
MUSB Mode Selection (Dual Role mode) --->
my usb drive not work on my device so I make module 'm' for Inventra Highspeed Dual Role Controller and generate musb-hdrc.ko file
I load new zImage and /lib/module/4/4/16 to my board and found .ko file in /lib... directory
root#arm:~# ls /lib/modules/4.4.16/kernel/drivers/usb/musb/musb_hdrc.ko
Now run "modprobe musb-hdrc" command and write "musb_hdrc" vi /etc/modules-load.d/modules.conf
above command run successfully and not see any error
after that reboot, the board run "lsmod" command to the sure module is load or not
root#arm:~# lsmod
Module Size Used by Not tainted
bridge 87777 0
stp 2111 1 bridge
llc 5184 2 bridge,stp
usb_f_rndis 21887 2
usb_f_ecm 9211 2
u_ether 11816 2 usb_f_rndis,usb_f_ecm
libcomposite 42715 16 usb_f_rndis,usb_f_ecm
omap_sham 22202 0
omap_aes_driver 19511 0
omap_rng 4212 0
rng_core 7198 1 omap_rng
musb_hdrc 78777 0
musb_hdrc load is successful.BUT when I connect my USB drive to USB port my USB drive not mount in /media also not show me at /dev why ?? am I missing something ?? also i check Kconfig file
config USB_MUSB_HDRC
tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, AW, ...)'
depends on (USB || USB_GADGET)
help
Say Y here if your system has a dual role high speed USB
controller based on the Mentor Graphics silicon IP. Then
configure options to match your silicon and the board
it's being used with, including the USB peripheral role,
or the USB host role, or both.
Texas Instruments families using this IP include DaVinci
(35x, 644x ...), OMAP 243x, OMAP 3, and TUSB 6010.
Analog Devices parts using this IP include Blackfin BF54x,
BF525 and BF527.
Allwinner SoCs using this IP include A10, A13, A20, ...
If you do not know what this is, please say N.
To compile this driver as a module, choose M here; the
module will be called "musb-hdrc".
So after exploring many things, I found that when I mark 'm' in Inventra Highspeed Dual Role Controller (TI, ADI, AW, ...) there are two another support which automatically goes to < > like
<M> Inventra Highspeed Dual Role Controller (TI, ADI, AW, ...)
MUSB Mode Selection (Dual Role mode) --->
*** Platform Glue Layer ***
< > OMAP2430 and onwards
< > AM35x
< > TI DSPS platforms
*** MUSB DMA mode ***
[ ] Disable DMA (always use PIO)
Here I forgot to notice that TI DSPS platforms and Disable DMA also goes to empty(< >) automatically when I select Inventra Highspeed Dual Role Controller. so I also check TI DSPS platforms and <*> for Disable DMA and then cross compile kernel and modules again
Now after when my board boot up successfully I see 3 new modules
root#arm:~# ls /lib/modules/4.4.16/kernel/drivers/usb/musb/musb_
musb_am335x.ko musb_dsps.ko musb_hdrc.ko
Then type lsmod command
root#arm:~# lsmod
Module Size Used by Not tainted
bridge 87777 0
stp 2111 1 bridge
llc 5184 2 bridge,stp
usb_f_rndis 21887 2
usb_f_ecm 9211 2
u_ether 11816 2 usb_f_rndis,usb_f_ecm
libcomposite 42715 16 usb_f_rndis,usb_f_ecm
musb_dsps 9418 0
musb_hdrc 72752 1 musb_dsps
omap_aes_driver 19511 0
omap_sham 22202 0
omap_rng 4212 0
rng_core 7198 1 omap_rng
musb_am335x 1547 0 [permanent]
and I successfully connect my USB drive to device which detect in /media location
But I am surprised here how to Musb_* module load automatically? I can't understand also when i remove am335x from /lib directory, all musb* module remove automatically
So how do I solve this automatically load module issue? anyone help me

Qemu: Emulating Raspberry pi with Buster OS on MacOS X (CLI works, but blank screen)

Trying to figure out why I have a blank screen for my Raspberry Pi running Buster OS in Qemu but do have a function CLI? Here's what I run:
$ qemu-system-arm -M versatilepb -cpu arm1176 -m 256 -hda ./raspbian-buster-full.qcow -net nic -net user,hostfwd=tcp::5022-:22 -dtb ./versatile-pb.dtb -kernel ./kernel-qemu-4.19.50-buster -append 'root=/dev/sda2 panic=1 rootfstype=ext4 rw' -no-reboot -serial stdio
And end up with a few failure messages:
vpb_sic_write: Bad register offset 0x2c
...
Welcome to Raspbian GNU/Linux 10 (buster)!
systemd[1]: Set hostname to <raspberrypi>.
systemd-fstab-generator[41]: Mount point file is not a valid path, ignoring.
...
[FAILED] Failed to start Load Kernel Modules.
See 'systemctl status systemd-modules-load.service' for details.
...
[FAILED] Failed to start rng-tools.service.
See 'systemctl status rng-tools.service' for details.
Not sure what vpb_sic_write: Bad register offset 0x2c relates to or the [FAILED] Failed to start Load Kernel Modules. But I'm OK with [FAILED] Failed to start rng-tools.service. because I think rng-tools are related to random number generation, and I don't need that.
At first I thought the lack of display was due to no console specified in the append option, but in the boot script I did see the following, which leads me to believe that was not the problem.
clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
Failed to initialize '/amba/timer#101e3000': -22
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
Console: colour dummy device 80x30
console [tty0] enabled
Any advice? Thanks!

How can I configure yocto to compile linaro eglibc for kernel 3.10.0

I'm working on a bsp layer for SBC Pine64 and my image is successfully generated but I'm getting "FATAL: kernel too old" when booting init
from busybox. I've checked my busybox binary and it's being compiled for kernel 3.14.0.
My kernel is version 3.10 and I've used Linaro 5.3 toolchain. I've tried adding: OLDEST_KERNEL = "3.10.0" and I've also tried using Linaro 4.9 but I
still get the same error. I'm using yocto Krogoth and generating core-image-minial. Please, see below a snip of the error from boot log:
[13.068932] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities
[13.086717] EXT4-fs (mmcblk0p2): couldn't mount as ext2 due to feature incompatibilities
[13.112988] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[13.127040] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[13.143393] devtmpfs: mounted
[13.151972] Freeing unused kernel memory: 520K (ffffffc0009e4000 - ffffffc000a66000)
FATAL: kernel too old
[13.198566] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
[13.198566]
[13.218884] CPU: 2 PID: 1 Comm: init Not tainted 3.10.102-pine64 #1
[13.230876] Call trace:
How can I configure yocto to compile linaro eglibc for kernel 3.10.0?
Thx,
Montez
When you want to override an existing variable that is not "soft-assigned", which is to say does not use the ?= syntax but instead = syntax, you need to use one of the variables in OVERRIDES as part of changing the value. You can see how overrides work already as in conf/bitbake.conf we have:
##################################################################
# Kernel info.
##################################################################
OLDEST_KERNEL = "3.2.0"
OLDEST_KERNEL_aarch64 = "3.14"
OLDEST_KERNEL_nios2 = "3.19"
And aarch64 is already found in your overrides list. Fortunately there are other values in that list, and when evaluating variables the ones later in the list in OVERRIDES take precedence. So in your local.conf you can do:
OLDEST_KERNEL_forcevariable = "3.10"
And then confirm that it has taken effect:
$ bitbake -e busybox | grep -E ^OLDEST_KERNEL=
OLDEST_KERNEL="3.10"

Gstreamer on OSX

I'm trying to create a very simply Gstreamer pipeline where I have a source element that is my FaceTime camera and a sink element that is a udp sink.
I first install Gstreamer using the instructions here. I ran some of the basic pipelines no problem; however, when I tried to use the following command
./gst-launch-0.10 v4l2src ! xviimagesink
I got the following error:
ERROR: pipeline could not be constructed: no element "v4l2src".
So I did some digging and turns out that the v4l2src plugin is in a gst-plugins-good. I installed these good plugins using macports using the following command:
port install gst-plugins-good
After a very long time everything installed without error. Now gst-launch appears in three places.
/Library/Frameworks/GStreamer.framework/Versions/0.10/bin/gst-launch-0.10
/opt/local/bin/gst-launch
/opt/local/bin/gst-launch-0.10
If I try to run the above mentioned pipline from any of those directories I still get
ERROR: pipeline could not be constructed: no element "v4l2src".
If I type the following command from anywhere I get some more errors but seems like it still is not finding v4lsrc.
gst-launch v4l2src ! xviimagesink
Gives:
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: Not enough memory)
ERROR: pipeline could not be constructed: no element "v4l2src".
So it seems like I have GStreamer mess and I still can't get my camera to work because GStreamer can't find v4l2src.
Some help would be appreciated! Thanks in advance.
v4l2src means "video-for-linux (ver.2) source".
since you are not running "linux", it is not so surprising that you cannot use "v4l2".
you might try to use the osxvideosrc (afaik this is in gstreamer-plugins-bad).
generally i suggest to check which elements are installed on your machine when you are looking for a a specific functionality, e.g.:
$ gst-inspect | grep -i video |grep -i source
PS: and usually i find it a good idea to throw some colorspace-converter (like ffmpegcolorspace) between a video-source and and -sink.
For me those two works from MacPorts (https://www.macports.org/):
GStreamer 1.0, applemedia: avfvideosrc: Video Source (AVFoundation), use device-index parameter to select a device (index will vary depending on the connection order).
bash-3.2# port install gstreamer1*
iCeDeROM:~ cederom$ gst-inspect-1.0 |grep video | grep src
inter: intervideosrc: Internal video source
decklink: decklinkvideosrc: Decklink Video Source
applemedia: qtkitvideosrc: Video Source (QTKit)
applemedia: avfvideosrc: Video Source (AVFoundation)
ximagesrc: ximagesrc: Ximage video source
videotestsrc: videotestsrc: Video test source
autodetect: autovideosrc: Auto video source
GStreamer 0.10 (autodetect: autovideosrc: Auto video source)
bash-3.2# port install gstreamer0*
iCeDeROM:~ cederom$ gst-inspect-0.10 |grep video | grep src
ximagesrc: ximagesrc: Ximage video source
inter: intervideosrc: FIXME Long name
gsettings: gsettingsvideosrc: GSettings video src
gconfelements: gconfvideosrc: GConf video source
autodetect: autovideosrc: Auto video source
applemedia: qtkitvideosrc: Video Source (QTKit)
applemedia: miovideosrc: Video Source (MIO)
videotestsrc: videotestsrc: Video test source
I use autovideosink or osxvideosink for testing (second works faster, first use Xorg). Use gst-inspect <module> for module information.

Resources