linux-device-driver

ioctl vs netlink vs memmap to communicate between kernel space and user space

喜你入骨 提交于 2019-11-27 04:40:56
Got some statistics information of our custom hardware to be displayed whenever user asks for using a command in the Linux user space. This implementation is currently uses PROC interface. We started adding more statistics information then we encountered a problem wherein the particular statistics command had to be executed twice for getting the entire data as PROC interface was restricted to 1 page. As mentioned above the data transfer between the kernel and the user space is not critical but as per the data some decisions might be taken by the user. Our requirement for this interface design

What does request_mem_region() actually do and when it is needed?

青春壹個敷衍的年華 提交于 2019-11-27 03:59:14
问题 I'm studying on writing embedded linux driver, and decided to fire a few GPIOs to make sure I understand the book (LDD3, chap9.4.1) correctly. I am able to control the correct GPIO pins as intended (making it high and low, I probed with a multimeter); however, I tested 2 pieces of code, one with request_mem_region() , and one without. I'm expecting the one without will fail, but both is working just fine. Code with request_mem_region : if( request_mem_region( PIN3_CONF_PHYS, MAPPED_SIZE_GPIO

Programmatically obtaining the vendor ID, product ID of a USB device on a Linux platform

江枫思渺然 提交于 2019-11-27 03:32:12
问题 I have been trying to write a simple device driver, in which I am suppossed to get the Vendor ID and Product ID programmatically. Having gone through almost all the necessary header files, I have come to a conclusion that I can access the vendor ID, product ID, and manufacturer details of the USB device through a structure: struct usb_device{} which has a member struct usb_device_descriptor{} . This nested structure has idVendor, idProduct and iManufacturer and some other members. But somehow

What is the difference between a Linux platform driver and normal device driver?

独自空忆成欢 提交于 2019-11-27 02:44:23
I previously had a thought about the platform driver as well as normal device driver like : Platform driver is for those devices that are on chip. Normal device driver are for those that are interfaced to the processor chip. Before coming across one i2c driver... But here, I am reading through multi function i2c driver defined as platform driver. I had gone through https://www.kernel.org/doc/Documentation/driver-model/platform.txt . But still could not get clear idea to come to an conclusion on how to define drivers, like for both onchip as well interfaced devices. Please somebody explain.

How to create a device in /dev automatically upon loading of the kernel module for a device driver?

你离开我真会死。 提交于 2019-11-27 02:43:57
问题 I am attempting to develop Linux device drivers and as my first attempt I am trying to develop a char device driver that has the following file options, struct file_operations fops{ .open=open_fun, .release=release_fun, .write=write_fun, .read=read_fun, }; When I load the driver using insmod , I see that /proc/devices lists the driver under char devices but I can't find it in /dev . A Google search suggested use of mknod to create a deivce in /dev and associate it with the driver's major and

Just black screen after running Qemu

南笙酒味 提交于 2019-11-27 02:22:05
I have just installed QEMU and compiled linux kernel with ARM support but when I run below command qemu-system-arm -M versatilepb -m 128M -kernel /home/arit/QEMU/linux-3.8.4/arch/arm/boot/uImage -append "console=tty1" I could only see Black screen ,I also tried what is being suggested in below thread Qemu shows a black screen But still it didn't work. Following is the output of make command which I run to compile kernel Source make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage -s Image Name: Linux-3.8.4 Created: Tue Dec 24 12:49:07 2013 Image Type: ARM Linux Kernel Image (uncompressed)

Linux keyboard event capturing /dev/inputX

梦想的初衷 提交于 2019-11-27 02:21:50
问题 I was trying to capture keyboard events. e.g. I want to drill down a keylogger from the scratch. After 2 hours of fighting I found the following neel@pc1$ ls -l /dev/input/by-id lrwxrwxrwx 1 root root 9 2010-05-05 21:33 usb-Plus_More_Enterprise_LTD._USB-compliant_keyboard-event-kbd -> ../event1 lrwxrwxrwx 1 root root 9 2010-05-05 21:33 usb-Plus_More_Enterprise_LTD._USB-compliant_keyboard-event-mouse -> ../event2 lrwxrwxrwx 1 root root 9 2010-05-05 21:33 usb-Plus_More_Enterprise_LTD._USB

Difference between arm-eabi arm-gnueabi and gnueabi-hf compilers [closed]

邮差的信 提交于 2019-11-27 00:14:39
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last month . What is the difference between arm-eabi, gnueabi and gnueabi-hf cross compilers. I am kind of finding it difficult to choose the compilers. Is there a native compiler for arm? 回答1: I'm not completely sure: the eabi stands for the compilation of code which will run on bare metal arm core. the gnueabi stands for

Mapping DMA buffers to userspace [closed]

女生的网名这么多〃 提交于 2019-11-27 00:12:34
问题 i am writing a device driver on linux-2.6.26. I want to have a dma buffer mapped into userspace for sending data from driver to userspace application. Please suggest some good tutorial on it. Thanks 回答1: Here is what I have used, in brief... get_user_pages to pin the user page(s) and give you an array of struct page * pointers. dma_map_page on each struct page * to get the DMA address (aka. "I/O address") for the page. This also creates an IOMMU mapping (if needed on your platform). Now tell

cat function calling read() infinite times

*爱你&永不变心* 提交于 2019-11-26 23:19:33
I am working on simple character device driver. I have implemented read and write functions in the module, the problem is when I try to read the device file using cat /dev/devicefile it is going into infinite loop i.e. reading the same data repeatedly. Can someone suggest me any solution to this problem? Below is my driver code. #include<linux/module.h> #include<linux/fs.h> #include<linux/string.h> #include<asm/uaccess.h> #include<linux/init.h> MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("character device driver"); MODULE_AUTHOR("Srinivas"); static char msg[100]={0}; static int t; static int dev