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

Unable to read Serial-Port (UART)

Below code is opening the second serial port and I am trying to read and write to it.Now I am using the console functionalities on the first port ( Tera Term Console ) to see the logs there (printf or dmesg ). But I am not able to read from the…
2
votes
1 answer

how to pass values to paremeters of a module when it is a built-in?

How to pass / set values to paremeters of a module when it is a built-in in linux? Hor example, consider the usb gadget g_mass-storage module. When it is compiled as a module (.ko) we can append the file name to the module as: modprobe…
user693986
  • 141
  • 3
2
votes
2 answers

Create a virtual multitouch device using uinput driver

I'm try to inject event on an android device without touchscreen. I'm using user space input device (uinput) to do so but it doesn't work. I'm using this code: fd_virtual_dev = open("/dev/uinput", O_WRONLY | O_NONBLOCK); if (fd_virtual_dev < 0) …
2
votes
1 answer

In linux, all kernel processes share the same kernel stack, each user process has its own stack, correct?

Furthermore, if a user process link a shared lib, say, glib, libX, libY, libZ, then glib and libX, Y, Z have their individual vma structs for text, data, but still share the same stack w/ the user process, correct ?
Yifan Zhang
  • 1,461
  • 3
  • 12
  • 19
2
votes
1 answer

Cache operations with SD/MMC driver in linux

What is the functionality of mmc_flush_cache & mmc_cache_ctrl with MMC driver in linux. I have found very little information on these, that mmc_flush_cache will flush the cache contents to the non volatile memory. But which cache memory they are…
user2706764
  • 67
  • 1
  • 4
2
votes
1 answer

Unknown type name "bool" when compiling kernel module

I am trying to compile a simple "hello world" kernel module for 3.8.13 on a beaglebone (ARM): hello.c: #include #include #include void init_module(void) { printk(KERN_INFO "My Kernel Module…
slumber
  • 91
  • 1
  • 6
2
votes
3 answers

How to install CUDA 5.5 drivers in FC18?

I've spent two days already trying to get it done, but no joy. Please help! I'm trying to install CUDA 5.5 drivers, the ones that come with the toolkit. As of yesterday, I've started at FC17, but in the course of various attempts, I've upgraded to…
user797257
2
votes
0 answers

How is Floating-point arithmetic implemented?

In the book - Linux Device Drivers, the author says the kernel code cannot do floating arithmetic at page 42. How does operating system do floating arithmetic without being supported by the kernel? I think, probably, I misunderstand the author. Can…
user2539662
  • 130
  • 2
  • 10
2
votes
2 answers

Inter-dependent out-of-tree kernel loadable modules in Linux

I have a design for two kernel loadable modules that I am building out of tree. These modules may run independently or they may work together (use the services of each other) when both are loaded. So I have module1.ko with funcA and funcB. I also…
Benjamin Leinweber
  • 2,774
  • 1
  • 24
  • 41
2
votes
1 answer

Linux apanic mechanism and difference from newer ram_console/persistent_ram mechanism

I am studying the different logging mechanisms on Linux in case of a Kernel panic (OOPS). So far from my search on the web, I have been able to derive the following information: apanic was an old mechanism of getting the job…
2
votes
1 answer

Use unregister_chrdev_region in case registration failed

I am learning how to write kernel drivers, and I have a doubt about the proper usage of the function unregister_chrdev_region. Right now I have a simple test module with just the init and exit functions: static dev_t devn; int __init…
ngoncalves
  • 33
  • 5
2
votes
1 answer

some flags about workqueue in kernel

i am dealing with the concurrency managed workqueues in linux kernel 2.6.36.But i am confused about the some flags. WQ_HIGHPRI WQ_UNBOUND WQ_RESCUER WQ_CPU_INTENSIVE I create a workqueue with flag WQ_HIGHPRI and queue some work items(eg w1 w2 w3…
Olyd Olyd
  • 33
  • 1
  • 5
2
votes
1 answer

Injection of touch events using screen driver

Using android-event-injector library, I wrote an application to inject a touch event when some event is triggered. The problem is that i need to inject touch at absolute coordinates of a given View, so I do the following to get the location on…
Vektor88
  • 4,841
  • 11
  • 59
  • 111
2
votes
1 answer

How to get notified by the Linux kernel if a new interface has been attached?

I want to be able to detect when a new external device is connected to the linux system and upon that send a notification message to a running process. I was wondering if there is any other solution than periodically scan for /dev/ and detect if…
fabrizioM
  • 46,639
  • 15
  • 102
  • 119
2
votes
3 answers

why struct cdev has kobject member?

It's strange that struct cdev has struct kobject member, do any body knows the reason?
Bill Wang
  • 197
  • 1
  • 10