Questions tagged [linux-device-driver]

Device drivers take on a special role in the Linux kernel. They are distinct programmatically abstracted “black boxes” that make a particular piece of hardware respond to a well-defined internal programming interface; they hide completely the details of how the device works.

User activities are performed by means of a set of standardized calls that are independent of the specific driver. Mapping those calls to device-specific operations that act on real hardware is the role of the device driver. This programming interface is such that drivers can be built separately from the rest of the kernel and “plugged in” at runtime when needed. This modularity makes Linux device drivers easy to write, to the point that there are now thousands of them available.

There are a number of reasons to be interested in the writing of Linux device drivers.

  • The rate at which new hardware becomes available (and obsolete!) alone guarantees that driver writers will be busy for the foreseeable future.

  • Individuals may need to know about drivers in order to gain access to a particular device that is of interest to them.

  • Hardware vendors, by making a Linux device driver available for their products, can add the large and growing Linux user-base to their potential markets.

The open-source nature of the Linux system means that if the driver writer wishes, the source to a driver can be quickly disseminated to millions of users.

Source -

  1. Linux Device Drivers 3rd edition

  2. Linux module programming guide

4991 questions
2
votes
2 answers

More than two SPI devices on an Arm board that supports only two?

The Arm processor on one of our boards has an spi port with two chip select lines. It is mentioned in the processor's datasheet that it can control upto two spi devices. Is it possible to use a GPIO as a slave select for an additional spi…
microMolvi
  • 636
  • 11
  • 30
2
votes
1 answer

kprobe vs uprobe system call interposition

I want to write a system call interposition by using Utrace. I understood that Utrace project has been abandoned, but part of its code is used on kprobe and uprobe. I haven't understood really well how these work. Especially uprobe Can you explain…
Giuseppe Pes
  • 7,772
  • 3
  • 52
  • 90
2
votes
2 answers

kthread & interupt -- handler --- is it possible

Is it possible for Linux driver to have one kthread, interrupt handle & system call's. Means does linux Kernel kernel allows all of above three ? Interrupt handler will save receive data from communication channel on interrupt. Kthread will transmit…
Katoch
  • 2,709
  • 9
  • 51
  • 84
2
votes
1 answer

Linux DMA operations - how to initiate a transfer

I have read the Linux Device Driver LDD3 , the DMA-API.txt, DMA-HOWTO.txt also took a look at the drivers/dma/dmatest.c but I could not figure out how you initiate a dma transfer. All of the discuss about mapping memory but none on how to initiate a…
akarapatis
  • 852
  • 8
  • 18
2
votes
1 answer

dynamically shared library -- for linux

I have just one question related to Linux shared library files. I saw lot of links related to dynamically shared library for the Linux O.S http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html Here in above link it is mentioned…
user1870619
  • 177
  • 1
  • 6
  • 12
2
votes
6 answers

How might I learn to write char device drivers for Linux?

How to write char device drivers in Linux?
user162965
2
votes
1 answer

Spinlock not working to protect critical section on multi-core system

I have a character device driver which is causing a system deadlock on a multicore system. The write call has a critical section protected by a spin lock (spin_lock_irqsave). The ISR must obtain this lock to finish its task as well. If the ISR is…
2
votes
2 answers

network interfaces and IFF_XX flags

I would like to understand if there are any conventions set up in kernel programming when creating network interfaces in the kernel and initializing interface flags, such as IFF_UP, or IFF_MULTICAST etc. What flags must be configured at minimum --…
Mark
  • 6,052
  • 8
  • 61
  • 129
2
votes
1 answer

Power Management Framework in Linux

I observed that the whole device topology is based on Buses --> Device + Driver. The power management offered by linux (suspend + resume) is present in bus. And similar functionality is there in device driver. struct bus_type { *** int…
shingaridavesh
  • 921
  • 1
  • 9
  • 19
2
votes
1 answer

Dynamic allocation in kernel space

I have been trying to allocate space using malloc in kernel space for a driver I am working on (using malloc is a constraint here; I am not allowed to allocate space in any other manner), but if I try to allocate "too many" elements (~500 times a…
pap42
  • 1,236
  • 1
  • 17
  • 28
2
votes
1 answer

Are GPIO APIs in linux deterministic in time taken?

I need to call gpio_get_value, gpio_set_value, gpio_direction_input/output in my driver, and there is a timing requirement that requests the function calls to be returned in less than 5us time. Can gpiolib meet this requirement or is it not…
user1697356
  • 161
  • 1
  • 3
2
votes
0 answers

Poll() with POLLOUT event always returns 0 when two threads are polling, but works with one

I am using a program called Netmap. I have two interfaces (eth0 and eth1) and I create a netmap instance on each of the interfaces. Let's call the file descriptor of eth0's netmap instance as fd0. Eth1's will be fd1. Also, the event here is…
Eddie
  • 163
  • 1
  • 3
  • 11
2
votes
2 answers

EXPORT_SYMTAB in 2.6 kernels

Noticed in our makefiles EXPORT_SYMTAB is used as described in here. Is it still relevant to 2.6 and above kernels? I can not find reference what it's current status, but can't find it in LXR.
dimba
  • 26,717
  • 34
  • 141
  • 196
2
votes
1 answer

Does copy_from_user modify the user pointer?

Does the copy_from_user function, declared in uaccess.h, modify the (void __user *)from pointer? The pointer isn't declared as const in the function declaration, only the contents it points to. The reason I ask is that I want to use copy_from_user…
Michael
  • 5,994
  • 7
  • 44
  • 56
2
votes
1 answer

Chardevice major number freeing

here is dumb chardevice lkm: #include #include #include #include MODULE_AUTHOR ("milo"); MODULE_DESCRIPTION ("alloc_chrdev_troubleshooting"); MODULE_LICENSE("GPL"); static int devmajor =…
milo
  • 1,220
  • 3
  • 17
  • 33
1 2 3
99
100