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
3 answers

device_create with existing device name

I'm learning how to write character device drivers as dynamically-loadable modules for the Linux. Typically I use the following sequence of function calls to register the device and create a device file which appears under…
Vilhelm Gray
  • 11,516
  • 10
  • 61
  • 114
2
votes
1 answer

current directory of a process in linux-kernel

Is it possible to get the process current directory via struct task_struct? I can see that struct fs_struct has pwd pointer, but I'm not able get the exact variable where this info is stored. Also, can we change current directory value?
foo_l
  • 591
  • 2
  • 10
  • 28
2
votes
1 answer

how to register a device driver with android/linux power driver?

I am working on a lcd related kernel level device driver for a android device. Can someone please help me with power management related APIs in Android through which I can register my driver to recieve any changes in device state. To be more…
Anshul
  • 1,416
  • 1
  • 16
  • 42
2
votes
2 answers

process information at runtime at kernel level

I am working on a linux kernel module which would take care of all the processes that are running for a specific task. Is it possible to know if the certain process named 'X' is still running or not and whats its current state???
user2077511
2
votes
2 answers

Understanding Device Driver code with running commmentary

I have a basic understand of the following: How to read hardware device Data Sheets How hardware devices work in theory What does a device driver do General concepts of C programming Linux OS I have always believed that if I can understand all the…
modest
  • 1,387
  • 3
  • 16
  • 20
2
votes
1 answer

Linux PCI driver - pci_enable_device fails

I'm fairly new to linux/kernels/drivers. I'm writing a driver for a pci card on embedded linux (3.2.17). The problem I'm running into is that in my probe function, result = pci_enable_device(dev) fails with the following error 0000:02:00.0: device…
greekygyro
  • 103
  • 1
  • 8
2
votes
1 answer

USB to USB communication

I have an ARM embedded machine with USB OTG controller and two other (Intel) embedded machines without USB OTG (standard type A connectors only). I want to configure the ARM machine as host and the other two machines as devices. How is that possible…
VigneshK
  • 753
  • 1
  • 10
  • 28
2
votes
1 answer

getting original MAC address using driver

Linux : uname -a :2.6.18 as well as 2.6.39 I am very new in it... When the driver is first loaded, before ifconfig can change the MAC address, the existing (permanent) MAC address is stored away, able to be retrieved via this ioctl. case…
Jatin Bodarya
  • 1,425
  • 2
  • 20
  • 32
2
votes
2 answers

How to detect which pixel format my webcam supports?

I am writing a C application that capture video from my webcam. I am not able to determine which pixel format my webcam is able to process. lsusb: Bus 002 Device 003: ID 1e4e:0100 Cubeternet WebCam dmesg [ 1064.735472] usb 2-1.4: new high speed…
Guilherme Longo
  • 2,278
  • 7
  • 44
  • 64
2
votes
0 answers

Does select() use kernel timer( in jiffies ) or high res timer

I have a application in which I have to sleep for a very short time (in order of few micro seconds ). Fortunately my Linux kernel 2.8.* supports high res timers. I have 2 options to sleep now nanosleep select() with a timeout. I choose to use…
KodeWarrior
  • 3,538
  • 3
  • 26
  • 40
2
votes
3 answers

Convert DMA mapping to virtual address

I have a somewhat unusual situation where I'm developing a simulation module for an Ethernet device. Ideally, the simulation layer would just be identical to the real hardware with regard to the register set. The issue I've run into is that the…
jhd1013
  • 98
  • 1
  • 4
2
votes
1 answer

How to get USB device details in kernel programming?

I am new to kernel programming and I have dev_t value of a USB device. I want to get the details of the device like vendor ID, product ID, or some other attribute which will vary from device to device. I want to do this in kernel space, and without…
upInCloud
  • 979
  • 2
  • 10
  • 29
2
votes
1 answer

maximum values of major and minor numbers in linux

I am learning linux device driver development and created the code of a basic kernel module which creates a pseudo char device. That module got compiled and inserted too.. When I did lsmod the result was like this Module Size Used…
gkr2d2
  • 693
  • 2
  • 9
  • 20
2
votes
2 answers

Android c++ service at boot time

I need to start a service at boot time in android i don't use broadcast receiver , i wrote a service in c++ because i need access driver libusb layer to communicate with my extrernal device ,the service is working properly if i started manualy,if i…
Mr.Cool
  • 1,525
  • 10
  • 32
  • 51
2
votes
0 answers

spin_lock_irqsave

I am facing odd problem with spin_lock_irqsave on a uni processor machine. I have a piece of critical code/function named with rx_process which is shared by two functions rx_timeout and rx_callback. This is located under a Linux kernel driver…
user1867459
  • 423
  • 2
  • 8
  • 27