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
1 answer

how to retrieve bus pointer from device tree

Question: I'm trying to find a way to retrieve the dev object for an mdio_bus that has been added to the device tree. I'm sure I'm going to be rapidly applying my palm to my forehead when I get past this, but for the life of me, I can't find the…
Brian K
  • 41
  • 4
2
votes
1 answer

Can the Linux Linked List API be used safely inside of an interrupt handler?

I am writing a device driver for a custom piece of hardware using the Linux kernel 2.6.33. I need am using DMA to transfer data to and from the device. For the output DMA, I was thinking that I would keep track of several output buffers using the…
Benjamin Leinweber
  • 2,774
  • 1
  • 24
  • 41
2
votes
2 answers

How to convert kmalloc() address to physical address

I have a PCI device which exposes a BAR and few offsets in the bar for accessing the device. On one of the Bar offset, i need to program a 64KB allocated memory. In my Linux driver, i allocate a 64KB of memory using kmalloc() which as i know returns…
pkumarn
  • 1,383
  • 4
  • 22
  • 29
2
votes
1 answer

How .ko file is built

I am trying to port my own driver to a Beagle board xm arm-cortex-A8. While porting I am trying to figuring out how the .ko file actually builds. In our Makefile we only have a command to build an.o file. How is a .ko file built? Using…
2
votes
1 answer

lpc1788 cortex m3 interrupt handling with uclinux

I am newbie for the uclinux device drivers please guide me how to do this.. suppose I have connected a switch to one of the cortex m3 controller pin and whenever the switched is press the LED connected to other pin of controller as to light. how to…
amar
  • 509
  • 3
  • 8
  • 17
2
votes
1 answer

Kernel development on virtualbox

Has anyone done kernel development on a VM, using Virtual Box or another? I'm not quite ready to hose my workstation at work, and would like a virtual environment to much around with the kernel. Suggestions?
2
votes
1 answer

Reading multi-channel serial usb in pure data

I have multichannel serial data from an 8 channel ADC chip that I'm connecting to my computer via a serial-USB cable. I want to use these separate channels in Pure Data, but the pd_comport object doesn't read multi-channel serial data. I've scoured…
buckocee
  • 101
  • 3
2
votes
1 answer

Including ioctl codes in userspace program

Is there is a common practice for userspace programs to include ioctl codes used in a kernel module. mydev.h: #ifndef MYDEV_H #define MYDEV_H #define #define MYDEV_IOC_MAGIC 'C' #define MYDEV_IOC_FOO _IO(MYDEV_IOC_MAGIC,…
Vilhelm Gray
  • 11,516
  • 10
  • 61
  • 114
2
votes
4 answers

what tool for debugging a linux kernel?

I am new to linux kernel. wandering how to browse the complete flow, right from the power up of CPU. Basic idea on BIOS/ROM code. can I have some tool to debug the complete kernel ? or raw code browsing is preferable ?
San
  • 905
  • 3
  • 16
  • 33
2
votes
0 answers

What does subsys_initcall in the Linux kernel do?

I ran into the line subsys_initcall(devfreq_init); in the devfreq.c file of the Linux kernel. I was just wondering when it is actually called and what it does.
John Roberts
  • 5,885
  • 21
  • 70
  • 124
2
votes
1 answer

How to remove /disable the 8250.o module and implement my own 8250 driver

I would like to disable or remove 8250.c (low level UART driver) module and to implement the same with basic functionally so as it will perform read and write request from user-space Here are my questions : How to remove / disable the 8250.0…
tamil_innov
  • 223
  • 1
  • 7
  • 16
2
votes
1 answer

How to block packets received by eth0 from going up to TCP/IP stack

We are using dev_add_pack with ETH_P_ALL to get copies of sk_buff of all ethernet frames received by eth1. Is there a way we can prevent eth1 from forwarding all the ethernet frames up to TCP/IP layer while still letting it capture all the frames…
lithiumhead
  • 861
  • 1
  • 9
  • 19
2
votes
1 answer

Simple char device driver / module - Linux RedHat 8 (2.4.18) on VM segmentation fault after ./module_unload

edit: I fixed the code and turned it to a more compact code regarding memory allocations, everything works now . You might aware me if I'm doing something wrong I'm not sure that the Write&Read implemantations are perfect.... #define ARRAY_LENGTH…
Idan Banani
  • 131
  • 2
  • 13
2
votes
0 answers

Simulating multi-touch events (one finger linear swipe)

I am doing an edit to a driver file that uses Multi-Touch protocol. My goal is to bind a swipe gesture from (x1,y1) to (x2,y2) that follows a line. To do this i execute this function inside the key pressure detection function: static void…
Vektor88
  • 4,841
  • 11
  • 59
  • 111
2
votes
2 answers

Initializing kernel module variables

I'm new to kernel and driver programming, so i hope my question is not too simple. I'm working with a madwifi driver, in order to add some functionalities of my own. In my code i added some variables and structures that need to be initialized before…
omer
  • 1,242
  • 4
  • 18
  • 45