linux-device-driver

Alternative Intel drivers for X

I'm having trouble getting X to run with the defaults on my chakra linux live-cd. It is an Arch based distro. I have a thinkpad x40 with Intel 855GME and I get "no valid modes" error from X. I figure I should try a different driver. But I'm not sure how I would do that. Can someone give me a few pointers? ...

What are the consequences of calling write() with zero length?

At fairly high level in the Linux write() function, it filters out requests for writing 0 length buffers. Which makes sense. Who'd want to the OS wasting it's time drilling through layers only to determine there is no work to be done? Well ... me. It's related to this question; and the discovery that the bit-banged I2C driver will g...

linux usb-hid :add libhid library to eclipse(C++) or netbeans IDEs or native input.h or hiddev.h ?

Hi i have problem with libhid . i found that there 2 way 4 accessing the usb-hid in linux 1)linux default libraries like input.h and hiddev.h and ... 2)using libhid i found libhid some confusing and try to use input.h but i have problem with that 2. i dont know how to get information about my device from ubuntu i use open() to op...

Does anyone know of a good manual/overview/reference for Open Firmware Device Trees (PowerPC LInux)?

I am trying to setup a driver for an embedded PowerPC board, and the correct way to do this today is to use the OpenFirmware Device Tree datastructure (the .dtb file, compiled from a .dts file). Creating a tree is pretty easy, but how do I get my device driver to find its node and the data in it? I have not managed to find any good ref...

How might I learn to write char device drivers for Linux?

How to write char device drivers in Linux? ...

git commit hash of an external loadable module

I'm developing a Linux kernel module outside of the Linux source tree (in the standard way) and am trying to automatically include the git commit hash of the driver into the version string printed out during the module load. The Makefile computes the git hash using the command DRV_TAG := $(shell git log -1 --pretty=format:"%h") but ...

Communicating between Kernel Threads in Linux

I am porting a app/PCI driver from vxWorks to Linux and I would like to keep the same architecture if possible. The current driver has 2 tasks(threads) that communicate with each other using message queues. Is there a mechanism to communicate between kernel threads? The message queues are being used to pass buffer addresses and size i...

error compiling the linux kernel

Hi, I was trying to compile the linux kernel, but getting some errors. While running the top Makefile i am getting the following errors :- CHK include/linux/version.h CHK include/linux/utsrelease.h SYMLINK include/asm -> include/asm-x86 HOSTCC scripts/selinux/mdp/mdp scripts/selinux/mdp/mdp.c:32:19: error: flask.h: No su...

Problem with chardev.c example from The Linux Kernel Module Programmers Guide

I compiled and ran the chardev.c example from the lkmpg and when writing to the device received an unexpected error: anon@anon:~/lkmpg$ sudo echo "hi" > /dev/chardev bash: /dev/chardev: Permission denied The module write function looks like this: /* * Called when a process writes to dev file: echo "hi" > /dev/chardev */ static s...

Running ctags for an external kernel module ( or pulling in tags from a separate related project )

I'm building a an 'external' module ( device driver ), i.e. it's not in the Linux kernel source tree, but in a separate unrelated source tree. I want to use ctags to browse variable / function declarations and definitions that are being pulled in from the kernel via header files. For example assuming I have: ~/src/kernel-source ~/src/...

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 the following. if(myDriver is loaded){ myDriver.functionCall(); } All examples I've...

Reading from a block device in kernel space

Hello 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) ...

Where has the the owner field of struct proc_dir_entry gone? [ Linux Kernel ]

According to the list of API changes in the 2.6 kernel series on LWN the .owner field of struct proc_dir_entry was removed in the 2.6.30 Kernel. So here's a couple of questions: Was it really ever necessary or useful to set this field? Has the field just been moved somewhere else, or permanently deleted? I ask the first question bec...

How to use/learn Video4Linux2 (On Screen Display) Output APIs?

My latest microprocessor( Freescale iMX233 ) has 8 hardware overlay plus inbuilt YUV to RGB conversion functionality. They have exposed these functionality through v4l2 driver. v4l2 Documentation doesn't say it properly that how to use it. Is there any tutorial available or any reference code which I can use to learn v4l2 apis? ...

Linux Kernel Modules: When to use try_module_get / module_put

I was reading the LKMPG ( See Section 4.1.4. Unregistering A Device ) and it wasn't clear to me when to use the try_module_get / module_put functions. Some of the LKMPG examples use them, some don't. To add to the confusion, try_module_get appears 282 times in 193 files in the 2.6.24 source, yet in Linux Device Drivers ( LDD3 ) and Ess...

Is there a way to ask the Linux Kernel to re-run its PCI initialization code?

I'm looking for either a kernel mode call that I can make from a driver, a userland utility, or a system call that will ask the Kernel to look at the PCI bus and either completely re-run its initialization, or initialize a specific device. Specifically, I need the Kernel to recognize a device that was added to the bus after boot and the...

How to know when a schedule() call is returning because of a signal?

In a device driver for some PCI hardware, I have an ioctl call that waits for an incoming interrupt on the PCI bus. Using wait_queue_head_t, I put the task to sleep by calling schedule(). Then, the irq_handler function wakes up this task when the interrupt is raised on the PCI bus. Everything seems to work correctly. My question is how...

copy_from_user twice - character device

Hello, I've implemented a character device and I'd like to ask If this is correct: In a Userspace I've a struct with 2 pointers. I write this struct into my device. In my write function in char device I copy_from_user this structure into kmalloced space. After this I'm in KS and got 2 pointers to US so I want to copy_from_user each. A...

Why does block I/O completion take so long when crossing CPUs?

I am trying to squeeze the most performance out of a Linux block driver for a high-end storage device. One problem that has me a bit stumped at the moment is this: if a user task starts an I/O operation (read or write) on one CPU, and the device interrupt occurs on another CPU, I incur about 80 microseconds of delay before the task resu...

Force Linux to use only memory over 4G?

I have a Linux device driver that interfaces to a device that, in theory, can perform DMA using 64-bit addresses. I'd like to test to see that this actually works. Is there a simple way that I can force a Linux machine not to use any memory below physical address 4G? It's OK if the kernel image is in low memory; I just want to be able...