Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [character-device]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
40 views

Is there any difference between #include <linux/ioctl.h> and #include <sys/ioctl.h>?

I have to write a device driver code for temperature sensor using IOCTL, when I was going through a lot of sample codes, I found while surfing the net, I came across this difference in header file, I ...
user avatar
  • 9
0 votes
1 answer
21 views

What's the difference between structures "cdev" and "inode" in the context of device driver programming?

I am currently studying device drivers in an operating systems course and am getting confused regarding the difference between the "inode" structs and "cdev" structs. Could someone ...
user avatar
  • 587
0 votes
1 answer
56 views

Problem printing the content of a waiting queue in Linux kernel

Context: Consider the following set of operations {A, B, C, D, E}: (A) : On the read() function of my device driver, I add the calling thread to a wait queue wq if a driver's buffer buf is empty. ...
user avatar
-1 votes
1 answer
58 views

Linux kernel register_chdev returned value

This video shows an example Raspberry Pi Linux kernel module which creates a new character device. It uses the kernel API register_chdev. In a comment to the video (I can not generate a direct link to ...
user avatar
  • 4,493
0 votes
1 answer
56 views

On UNIX OS, for which of the following I/O devices the access is not via a special file of type "character I/O"? [duplicate]

On UNIX OS, for which of the following I/O devices the access is not via a special file of type "character I/O"? Mouse Screen Disk On Key (USB) Printer None of the above This question is ...
user avatar
  • 1
1 vote
1 answer
160 views

How to open and read a character device as binary file?

I'm working with USB and I want to read the content of usb device descriptor in /dev/bus/usb/00x/00y - it is a character device. I used fopen to open it as a binary file with "rb" parameter. ...
user avatar
0 votes
1 answer
462 views

Concurrent write access to character device file

I am wondering what happens when two processes write to a character device file at the same time. Currently, I am mostly worried about /dev/spidev0.0 on a Raspberry pi. If I assume correctly that it's ...
user avatar
1 vote
0 answers
67 views

MITM / Proxy for Character devices

I have a character devices file, say /dev/X and I would like to capture every interaction which goes in and out of /dev/X. I'm looking for a way to create some kind of MITM/Proxy to that file. Edit: ...
user avatar
2 votes
0 answers
56 views

May a character device only handle blocking I/O?

Let's consider the following (imaginary) device: a clock which takes 1 second to query, then returns the current time. We want to write a character device driver for it, which supports read operations ...
user avatar
  • 620
0 votes
1 answer
221 views

How are the TTY and serial_core related?

I need to write a new character device file for the UART, which allows a few more file operations than usually allowed (not just open, write, etc..) I'm on an embedded mainline linux kernel (v 5.4). I ...
user avatar
  • 11
0 votes
0 answers
60 views

Are /dev/i2c-1 and /dev/mem colliding?

I write a program which should handle a motion sensor and an ultrasonic sensor at the same time. I'm using a Jetson Nano with 40 GPIO-pins. The first one uses I2C interface and thus accesses /dev/i2c-...
user avatar
0 votes
2 answers
567 views

Is keyboard driver a character device driver?

I am learning device drivers and I got this doubt , is keyboard driver a character device driver in Linux?
user avatar
  • 113
1 vote
1 answer
122 views

what will the kernel do when an USB mouse inserted in Linux PC?

I am trying to write a kernel module which loads upon detection of USB Mouse. I am new to this stuff, I googled for this issue but couldn't find any appropriate solution. can anyone please explain ...
user avatar
1 vote
1 answer
459 views

Kernel throws error while writing to the character device file in 4.9.82-ti-r102 debian 9.3

I created the device file under /dev folder successfully, but writing to that device file makes kernel to throw following error messages. Message from syslogd@beaglebone at Feb 26 15:40:10 ... kernel:...
user avatar
1 vote
0 answers
3k views

Nvme not showing up in /dev on Ubuntu 19.04 (5.0.0-13)

I have an Ubuntu 19.04 on a machine with an nvme drive. However, the drive is not found in /dev/nvme*. cat /proc/devices shows that nvme is loaded as a character device and not a block device and ...
user avatar
  • 11
-1 votes
1 answer
264 views

make a pseudo device like /dev/random that outputs primes?

/dev/primes is what I want without writing C code just python which I have known and easily written the program. The device file should be similar to /dev/urandom that outputs primes instead of ...
user avatar
0 votes
1 answer
171 views

Send Shift PgUp to the console

With a little help from an answer found here I was able to use below script to send keystrokes to the VGA console /dev/tty1 #!/usr/bin/perl use warnings; use strict; open( my $TTY1 , '>' , '/dev/...
user avatar
  • 13.1k
0 votes
0 answers
238 views

How to create a new character device under /proc/device file?

I am trying to create a node with mknod /tmp/ttyACM0 c 166 0 command but then No such device or address error returns when I try to open serial port with ttyACM0 because there is no device in proc/...
user avatar
  • 125
-2 votes
1 answer
269 views

Does the virtual filesystem work on top of character devices and network subsystems?

Does the virtual filesystem work on top of character devices and network subsystems, or just on top of filesystems and block devices? Could you also explain a bit about in what sense "the VFS is ...
user avatar
  • 89.9k
4 votes
1 answer
2k views

Is a device being a block or character device determined purely by hardware?

From https://unix.stackexchange.com/a/472920/674 A "character device" and "block device" are abstractions, usually used in Unix-style systems in classifying various devices. Is a device being a ...
user avatar
  • 89.9k
-2 votes
1 answer
191 views

Why is the transfer unit of block devices block not page?

Operating System Concepts says A character-stream device transfers bytes one by one, whereas a block device transfers a block of bytes as a unit. But I heard that the unit of transfer between main ...
user avatar
  • 89.9k
1 vote
2 answers
767 views

Do "serial ports" or "parallel ports" apply to character devices only, but not to block devices?

From http://haifux.org/lectures/86-sil/kernel-modules-drivers/node10.html A Character ('c') Device is one with which the Driver communicates by sending and receiving single characters (bytes, ...
user avatar
  • 89.9k
-3 votes
1 answer
413 views

Are there implications between block/character device and random/sequential access? [closed]

Operating System Concepts says: Devices vary on many dimensions, as illustrated in Figure 13.7. • Character-stream or block. A character-stream device transfers bytes one by one, whereas a block ...
user avatar
  • 89.9k
1 vote
1 answer
2k views

Can filesystems be created only on block devices, but not on character devices?

Can filesystems be created only on block devices, but not on character devices? Can a filesystem be viewed as a block device itself (for example, when programming to use a file system)? My guess is ...
user avatar
  • 89.9k