1
votes

In linux kernel, a device (e.g. camera) can register as a file (e.g. /dev/video11). How can I find out from the code which driver is registered as '/dev/video11'. i.e. what is the driver will be invoked when I open('/dev/video11', O_RDWR,0) in my user space code?

If I can only search within the code space, how can I find out which driver is for '/dev/video11'?

Is there a config file which I can look it up?

1
A device driver is a bunch of functions. It doesn't necessarily have a name. - n. 1.8e9-where's-my-share m.
If the code open('/dev/video11', O_RDWR,0), what is the corresponding driver code get executed? that Is what I would like to know. Thank you. - michael
Back to square one. A device driver is a bunch of functions. How do you distinguish a bunch of functions from another bunch of functions? - n. 1.8e9-where's-my-share m.
I don't know. I would like help to answer that question. I am studying android source code. From here, it has code which open("/dev/video11", O_RDWR, 0) as decoding device. androidxref.com/4.4.2_r1/xref/hardware/samsung_slsi/exynos5/… I want to find out which is the corresponding driver code for device '/dev/video11'. Thank you very much. - michael
I'm sorry, I lied :( My kernel knowledge is somewhat outdated. Device drivers do have names. Look under /sys/bus/*/driver. If it's a USB camera you are likely to find it under /sys/bus/usb/driver. Then the name is generally the same as the directory name in which driver sources live. - n. 1.8e9-where's-my-share m.

1 Answers

1
votes

Checkout a very similar question on the Unix & Linux StackExchange.

For your device, parsing the output of this command may help.

$  udevadm info -a -n /dev/video11