linux-device-driver

Linux device driver unsafe FXSAVE/FXRSTOR bug -- any precedents?

There's a nasty problem that has temporarily stumped a number of engineers at my company trying to debug it. The C++ program is normally run on a cluster of multicore computers with MPI. It will run for a very long time -- perhaps days -- and then suddenly fail. Most of engineers working on it have eliminated any reasonable possibilit...

What are coding conventions for using floating-point in Linux device drivers?

This is related to this question. I'm not an expert on Linux device drivers or kernel modules, but I've been reading "Linux Device Drivers" [O'Reilly] by Rubini & Corbet and a number of online sources, but I haven't been able to find anything on this specific issue yet. When is a kernel or driver module allowed to use floating-point r...

What do I need to compile the kernel on Ubuntu Eee?

I'm trying follow a tutorial to create a custom USB driver in Linux and I hope to develop this thing on my Eee PC with Ubuntu Eee using g++. Unfortunately to follow the tutorial I need the linux/module.h header file. From what I understand I will need to compile the kernel to get this to work. I never compiled a kernel before and all ...

How do I write a new Linux driver for an i2c device?

I have a usb device with some i2c control functions and I would like to add a userspace API for twiddling those bits. How do I add i2c support to my device's existing driver? ...

Entries in /proc/meminfo

I can make sense of most of the information contained in /proc/meminfo like total memory,buffers, cache etc. Could you tell me what do the less obvious ones like *AnonPages,Mapped,Slab,NFS_Unstable,Bounce,VmallocTotal,VmallocUsed,VmallocChunk* mean? ...

Memory usage of a kernel module

While trying to estimate the amount of memory consumed by a kernel module (usually device drivers),I tried using the size utility which gave the size of the static memory areas of the .ko ( .bss, .data, .text etc). So I was expecting the sum of these values to be exactly equal to the output given by the lsmod command immediately after in...

ioctl return -1 with errno set to EPERM

Hi, I have a c program which calls ioctl() but it return -1 and errno set to EPERM. But I have changed mode of that file to "777". Can you please tell me why it ioctl still return -1 with errno set to EPERM? Thank you. ...

open() returns with "No such device" error, but there is such a device (linux)

I'm trying to use a somewhat old DAQ, and had to jump through a few hoops to get an old (circa 2004) device driver for it to compile (DTI-DT340 Linux-DAQ-PCI). I've gotten to the point where it compiles, I can load the the kernel module, it finds the card, and I can create the character devices using mknod. But I can't seem to open the...

Linux socket programming debug?

Hi, I have a function just like this: static int rcv_kern(int sock, void *buf, int len, struct sockaddr *addr, socklen_t *addrlen) { struct timeval timeout = {1, 0}; fd_set set; int status; FD_SET(sock, &set); if ((status = select(sock + 1, &set, NULL, NULL, &timeout)) == 0) { FD_ZERO(&set); fprintf(s...

"Echo" device for Unit Testing

I'm currently writing up some CPPunit tests for a program that tests a hardware communication port (yes, I'm writing unit tests for a tester app ;-) ). One of the classes I'm testing is basically a wrapper around the device's file descriptor; I make read() and write() calls on the file descriptor. Is there a device file/driver on Linux...

How to port USB RNDIS device driver?

Firstly: I am totally a newbie for this kind of work. I have a USB rndis device driver for some hardware only working in XP/2000/Vista. But I want to port this to CE or Linux, and vendor also says that developer should do that. In summary, I have XP drivers and Interface/End point configurations the driver has. And I have two questions...

How does Linux Kernel know where to look for driver firmware?

I'm compiling a custom kernel under Ubuntu and I'm running into the problem that my kernel doesn't seem to know where to look for firmware. Under Ubuntu 8.04, firmware is tied to kernel version the same way driver modules are. For example, kernel 2.6.24-24-generic stores it's kernel modules in: /lib/modules/2.6.24-24-generic and it'...

how to code drivers?

I want to code drivers in C in linux os, though I think its very tough. Can I get some hints as to how to start or books to follow? Drivers can be from my USB port to graphics card!! I know as to where I can search for books, I would like to know as to what the basic knowledge I should start with. Do I need to have hardware knowledg...

Linux: direct access to the hard-disk in C

How can I obtain a raw access to the HD and know if that location is used or is a free space? Just a piece of example, I can obtain a direct access simply with an open and a read on a disk device, the goal is knowing whether the, for example, the 10.000 byte is used or not. ...

Content for Linux Operating Systems Class

I will be TA for an operating systems class this upcoming semester. The labs will be deal specifically with the Linux Kernel. What concepts/components of the Linux kernel do you think are the most important to cover in the class? What do you wish was covered in your studies that was left out? Any suggestions regarding the Linux kerne...

Cross Compiling Linux Kernels and Debugging via VMware

I'm considering doing some Linux kernel and device driver development under a vmware VM for testing ( Ubuntu 9.04 as a guest under vmware server 2.0 ) while doing the compiles on the Ubuntu 8.04 host. I don't want to take the performance hit of doing the compiles under the VM. I know that the kernel obviously doesn't link to anything o...

The same driver for multiple network cards -- performance bottleneck?

I'm using driver e1000e for multiple Intel network cards (Intel EXPI9402PT, based on 82571EB chip). The problem is that when I'm trying to utilize maximum speed (1GB) on more than one interface, speed on each interface starts to drop down. I have my own driver in kernel space designed to just sent given packets. It just allocs packets b...

kvm vs. vmware for kernel debugging / USB driver development

The title says it all. I'm currently setting up vmware Server 2.0 for kernel debugging with gdb ( see this setup guide ) and someone asked me why not use kvm? So I ask: kvm vs. vmware for kernel debugging / USB driver development what are the pros and cons of each? ...

What would be the simplest way to interface custom hardware with one input to have switch somewhere in /proc?

I have a device that takes low current 3-12v input signal to do it's magic and I would like to interface it to my linux box. What kind of options do I have on this? It would be great to have some low-cost possibly user-space solution. ...

How to develop a USB mass storage simulator in Linux?

Hi, I am new to programming USB. I want to develop a simulator in Linux for USB mass storage devices. I would be thankful to you if you share links. ...