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 make an linux kernel project in eclipse ctd?

I want to do some Linux kernel programming. I have chosen Eclipse CDT as my IDE but i can't seem to get a project started. By started i mean that i can't get trough the project wizard. I have followed different tutorials like this one: Link to…
RSNL
  • 213
  • 3
  • 15
2
votes
2 answers

In my read function myread it is continuously printing the read data when i do cat /driver/mydriver. I need to print only once how to do that

I wrote h into driver by doing echo: echo -n h /dev/mydriver When I do cat /dev/mydriver, myread function is printing h continuously. I wanted to print once. How to do that. static char m; static ssize_t myread(struct file *f, char __user *buf,…
kzs
  • 1,793
  • 3
  • 24
  • 44
2
votes
3 answers

nopage () method implementation

Any one know about how virtual address is translated to physical address in no page method. with reference to Device Drivers book the nopage method is given as , struct page *simple_vma_nopage(struct vm_area_struct *vma, unsigned…
2
votes
2 answers

Reading character devices in linux

I read the device file /dev/hidraw0 when in the terminal by typing cat /dev/hidraw0 as the hidraw0 was the usb mouse, the output was a sequence of characters. This sequence was generated as I moved the mouse, clicked and scrolled. Then I also tried…
2
votes
1 answer

Linux Driver real time constraints

I need to build a platform for logging some sensor data. And possibly later doing some calculations on this logged data. The Raspberry Pi seem like an interesting (and cheap!) device for this. I have a gyroscope that can sample at 800 Hz which is…
2
votes
2 answers

copy_to_user not working in kernel module

I was trying to use copy_to_user in kernel module read function, but am not able to copy the data from kernel to user buffer. Please can anyone tell me if I am doing some mistake. My kernel version is 2.6.35. I am giving the portion of kernel module…
sandy
  • 123
  • 1
  • 2
  • 5
2
votes
0 answers

Writing USB driver for Raspberry Pi

I am trying to write a USB device driver for Raspberry Pi board (practising on my Ubuntu desktop first). Whenever two flash drives are inserted, data from second will automatically be copied into the first flash drive. Whenever a flash drive and a…
2
votes
3 answers

Determine if a usb is mounted using lsusb data

I'm trying to identify if a usb storage device (usb stick) is mounted or not on a linux distro (modified Ubuntu 10.04). At the moment I use the lsusb -v command and parse it to obtain the Bus, Device and ID of the USB device I'm interesed in.…
Kraken18
  • 663
  • 2
  • 11
  • 25
2
votes
2 answers

Kernel macro for counting bits set

Is there a standard Linux Kernel bit operation macro, which returns the number of bits set in an unsigned long ?
2
votes
1 answer

What is the dataflow of using touchscreen with tslib?

I don't understand how tslib works. Let's say I have a serial touchscreen, in my understanding the data flows in the following way: ts press -> serial port -> ts driver -> tslib -> device file (like /dev/input/eventX) Is it right? Or do I need to…
beaver
  • 550
  • 1
  • 9
  • 23
2
votes
1 answer

how to create a /dev/entry after doing an insmod of a module

I have been provided a Linux kernel module with these instructions: insmod . Then determine the major number and create a /dev entry. I was able to successfully install as is evident from the dmesg file. However, I do not know how to determine the…
doon
  • 2,311
  • 7
  • 31
  • 52
2
votes
1 answer

linux network drivers --- net_device_ops

so far i have only used file operational structure in device driver. Using system call open & read , write. How to open device driver & transmit data using net_device_ops ? Is there reference example on net for the user program to interact with it…
Katoch
  • 2,709
  • 9
  • 51
  • 84
2
votes
2 answers

Modifying the bio structure in linux

I am attempting to modify the bio structure (in blk_types.h) for linux-3.2.0 (running Ubuntu). The only thing I need to do to this structure is to add an additional variable to keep track of an integer variable (it is for a tainting algorithm). …
2
votes
1 answer

Serial driver hw fifo overrun at 460800 baud rate

I am using 2.6.32 OMAP based linux kernel. I have observed that at high speed data rate (Serial port set to 460800 baud rate) serial port HW fifo overflow happens. The serial port is configured to generate interrupt at every 8 bytes in rx and tx…
user1867459
  • 423
  • 2
  • 8
  • 27
2
votes
2 answers

Startup code for -- linux IRQ interrupt hander for ARM

For last few days i am studying a lot about linux chapter 10 book ldd3. I have some doubt please clarify them. Some are my analysis please suggest if they are wrong. For ARM there is one interrupt vector table address for -- IRQ interrupt --…
Allan
  • 2,971
  • 4
  • 24
  • 28
1 2 3
99
100