• We did not send an email asking for donations - please read this post.

Linux device interaction

LuckyLuke93

New Member
Joined
Aug 31, 2022
Messages
5
Reaction score
0
Credits
53
In Linux, is it possible for an application interacts with hardware device( for instance: camera) without using /dev/* device file?So I mean is possible to use hardware device without making or “using” /dev/* device file?
 


wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
7,784
Reaction score
6,611
Credits
28,633
I likely won't be the one to answer your question but the first thing I would ask is

Why? What are you trying to do?

This is likely better suited to Linux Hardware so moving this there.

Welcome to linux.org

Chris Turner
wizardfromoz
 
OP
L

LuckyLuke93

New Member
Joined
Aug 31, 2022
Messages
5
Reaction score
0
Credits
53
I don't know if it is the right forum to do this question but i try. I’m interested to monitor all resources related to video recording through camera in Pixel 3a with Android 8.0. So to do that, I’m used the Android camera application to record a merely a video. I discovered that although the camera works, there is not any device file in /dev. It is strange. I know that Android handles device as Linux so i should find a device file in /dev that binds driver device(major number) to hardware device (minor number )… Is there another approach to interact with hardware? i know that all application use camera directly or indirectly( by interacting with system processes) use device file located in /dev...
 

kc1di

Well-Known Member
Joined
May 14, 2021
Messages
1,275
Reaction score
1,061
Credits
9,149
I'm not sure as @wizardfromoz has already asked, why you would want to use a device without a /dev file entery. But in Linux just about everything is a file and part of the file system. Here are a couple of links that may help the understanding.
Everything is a file and Managing devices
Welcome to the Forum. :)
 

Lord Boltar

Well-Known Member
Joined
Nov 24, 2020
Messages
1,906
Reaction score
1,315
Credits
14,167
Device nodes on Linux systems do not necessarily have to correspond to any physical devices. Nodes that lack this correspondence form the group of pseudo-devices. They provide various functions handled by the operating system. Some of the most commonly used (character-based) pseudo-devices include:
/dev/null – accepts and discards all input written to it; provides an end-of-file indication when read from.
/dev/zero – accepts and discards all input written to it; produces a continuous stream of null characters (zero-value bytes) as output when read from.
/dev/full – produces a continuous stream of null characters (zero-value bytes) as output when read from, and generates an ENOSPC ("disk full") error when attempting to write to it.
/dev/random – produces bytes generated by the kernel's cryptographically secure pseudorandom number generator. Its exact behavior varies by implementation, and sometimes variants such as /dev/urandom or /dev/arandom are also provided.

So there is at least some things that may not require /dev/ but they still do create these pseudo-devices links through /dev/ to function

BSD based OS has specific pseudo-devices with an ioctl interface but I am not that knowledgeable on BSD and cannot comment any further on BSD

Nodes are generally created by the mknod system call. The command-line program for creating nodes is also called mknod. Nodes can be moved or deleted by the usual filesystem system calls (rename, unlink) and commands (mv, rm).

Some Unix versions include a script named makedev or MAKEDEV to create all necessary devices in the directory /dev. It only makes sense on systems whose devices are statically assigned major numbers (e.g., by means of hardcoding it in their kernel module).
 

osprey

Active Member
Joined
Apr 15, 2022
Messages
247
Reaction score
147
Credits
2,262
LuckyLuke93 wrote:
I discovered that although the camera works, there is not any device file in /dev.
If you mount the card from the camera in a card reader, it mounts as a usb device for which there will be a /dev directory entry which is usable in the normal way. Not all hardware is given a device file. Network devices are interfaces so the normal operations such as read and write do not apply to them, so not everything is a file, though most things in unix are.
 

bob466

Well-Known Member
Joined
Oct 22, 2020
Messages
640
Reaction score
447
Credits
4,680
Not something I've ever worried about.
happy0031.gif
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top