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 do "make drivers/usb/storage/usb-storage.ko"

How can I compile usb-storage.ko (only) from kernel source tree ? Running kernel version: 2.6.35-22-generic (uname -r) Source version: linux-2.6.35 Doing modprobe usb-storage gives the below error. FATAL: Error inserting usb_storage…
San
  • 905
  • 3
  • 16
  • 33
2
votes
0 answers

Inserting ethernet frames of a particular ethertype in ahead of TCP/IP frames in netdev_queue

We have developed an Application Specific Integrated Circuit for power line communications. The chip has an ethernet interface. If the ASIC receives an ethernet frame containing TCP/IP or ARP payload (ethertypes 0x0800 IPv4, 0x0806 ARP and 0x86DD…
lithiumhead
  • 861
  • 1
  • 9
  • 19
2
votes
1 answer

Getting dmesg in the terminal

Is it possible to get dmesg logs in terminal automatically each time a log comes to /var/log/messages just to avoid typing dmesg or dmesg
2
votes
1 answer

Linux kernel network device driver and skb pointers

I am writing a network device driver. Kernel 2.6.35.12 The device is supposed to be working when it is connected to a bridge port. I am trying to intercept ICMPv6 RA and NS messages (Router/ Neighbor solicitation) forwarded to the interface from…
Kimel
  • 199
  • 1
  • 7
2
votes
2 answers

Linux Device Driver

I have problem concerning about my module it it installed/initialized correctly but the other parts of the driver is not installed or showing up in the output. static struct i2c_driver qt2120_dev { .probe = qt2120_probe, .remove =…
Franz Mationg
  • 61
  • 2
  • 9
2
votes
2 answers

Reading from a block device in kernel space

I am writing a kernel module and need to perform reads from an existing block device. (/dev/something). Does anyone know of any other modules that do these that I can use as reference ? Any pointers would be welcome (Linux.2.6.30)
Boris
  • 3,163
  • 5
  • 37
  • 46
2
votes
3 answers

How can I test my driver is loaded, and then access my driver functions from the linux kernel?

I have a driver which compiles and loads into the linux kernel just fine. In this driver are some functions which I would like to access from the kernel file 'fs/readdir.c'. Additionally, how can I test if a driver is loaded? I need something like…
cheesysam
  • 1,109
  • 5
  • 15
  • 32
2
votes
2 answers

Using an old device file for char device driver

I have two questions as I'm trying device drivers as a beginner. I created one module , loaded it, it dynamically took major number 251 say. Number of minor devices is kept 1 only i.e minor number 0. For testing , I tried echo and cat on the…
2
votes
1 answer

How to load a modified kernel module which is already exist in precompiled kernel

one way is to do so is to build the kernel sources again with making original module loadable which need to be modified. so original module can be removed and modified module can be inserted. but this is time consuming process. I am wondering if…
raj_gt1
  • 4,653
  • 2
  • 20
  • 28
2
votes
2 answers

Char device driver using interrupt - linux

I have a question about a char driver. A char driver using GPIO pins to communicate with a hardware device, including interrupt interfacing. The driver's "release ()" method is missing. What order should function elements put in? A. Delete cdev and…
user2439427
  • 131
  • 1
  • 9
2
votes
2 answers

what is the use of trap value?

I'm a newbie in kerel. In a linux kernel macro definition, I saw a line li r10 trap I would like to know the use of this 'trap' value. Thanks in advance
ebin
  • 175
  • 1
  • 1
  • 12
2
votes
1 answer

How to assign different drivers to NICs which are of the same types in Linux

I have 5 e1000e NICs in my system, and I want 3 of them to load default e1000e driver while 2 of them to use a modified e1000e driver which is made by myself. How can I do this? Code is preferred if you can provide any.
dcnocomment
  • 104
  • 6
2
votes
1 answer

How to programmatically determine bpp and pixel color format of android screen?

I am trying to stream compressed raw framebuffer data to my Client application on the PC, from my Server service on Android. On the PC I want to display this raw data as streamed video in my Client's view, giving real-time view of the Android…
piyush-2450
  • 51
  • 1
  • 10
2
votes
1 answer

Getting warning message when allocating memory using pci_alloc_conssitent

I have a requirement to allocate 128K memory of 4K aligned of 64 chunks. Currentyl using pci_alloc_consistent() as allocated phy_addr needs to have DMA capability. When i do this, i get the below warning message. Does this mean my request…
pkumarn
  • 1,383
  • 4
  • 22
  • 29
2
votes
3 answers

Alternatives to googling Linux log messages?

I am intermediate Linux user which has basic knowledge of programming (c, perl, js ...) and some system troubleshooting (strace, SystemTap, lsof ...) and I am tired of Googling the messages which comes to Linux logs (/var/log/messages). I would like…
Wakan Tanka
  • 7,542
  • 16
  • 69
  • 122