linux-device-driver

How nl80211 library & cfg80211 work?

别来无恙 提交于 2019-11-28 13:50:30
问题 I want to learn about how nl80211 and cfg80211 works in detail. Function flow, how nl80211 interact with network tools like wpa_supplicant , iw . Plz suggest me some useful links or books to refer. 回答1: To be able to control wireless drivers from userspace, some IPC communication processes between kernel and userspace are used. At first ioctl with vendor dependent APIs was used. In 1996, Jean Tourrilhes creates wireless extensions (WE or WEXT). The Wireless Extension (WE) is a generic API

How to write a simple Linux device driver?

两盒软妹~` 提交于 2019-11-28 13:32:39
问题 I need to write an SPI Linux character device driver for omap4 from scratch. I know some basics of writing device drivers. But, I don't know how to start writing platform specific device driver from scratch. I've written some basic char drivers, and I thought writing SPI device driver would be similar to it. Char drivers have a structure file_operations which contains the functions implemented in the driver. struct file_operations Fops = { .read = device_read, .write = device_write, .ioctl =

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

蓝咒 提交于 2019-11-28 10:17:10
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, for some reason I am unable to access these members, so when I do a dmesg after inserting my module,

how to use 'cat' in following simple device read program

拟墨画扇 提交于 2019-11-28 09:24:20
问题 static ssize_t device_read (struct file* filp, char *bufStoreData, size_t bufCount, loff_t* curOffset) { printk(KERN_INFO"reading from the device"); ret = copy_to_user(bufStoreData,virtual_device.data,bufCount); return ret; } does copy_to_user returns number of bytes remaining to read or number of bytes read? whats the use of bufcount if i am using cat if all the data is not read in single call how it can read the remaining data?Is this responsibility of application to issue system call again

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

时光怂恿深爱的人放手 提交于 2019-11-28 09:13:52
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 minor. However, an attempt to do so resulted in "Permission denied" error even when done as a super

Linux keyboard event capturing /dev/inputX

非 Y 不嫁゛ 提交于 2019-11-28 08:31:31
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-compliant_keyboard-mouse -> ../mouse1 But when I tried to neel@pc1$ sudo cat /dev/input/usb-Plus_More

call to request_mem_region() fails

馋奶兔 提交于 2019-11-28 06:07:52
问题 The start address 0x4806E000 (UART4 base address) is already present in /proc/iomem with the name omap4-uart. How to disable the memory regions already allocated ?. Edit : Even though request_mem_region is successful the console during booting shows this messages. [ 0.758514] Serial: 8250/16550 driver, 3 ports, IRQ sharing enabled [ 0.760040] omap_uart.0: ttyO0 at MMIO 0x4806a000 (irq = 104) is a OMAP UART0 [ 0.760498] omap_uart.1: ttyO1 at MMIO 0x4806c000 (irq = 105) is a OMAP UART1 [ 0

Mapping DMA buffers to userspace [closed]

ぐ巨炮叔叔 提交于 2019-11-28 04:01:30
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 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 your device to perform the DMA into the memory using those DMA addresses. Obviously they can be non

Difference between arm-eabi arm-gnueabi and gnueabi-hf compilers

五迷三道 提交于 2019-11-28 03:56:23
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? 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 the compilation of code for linux For the gnueabi/gnueabi-hf part, I found an answer here . gcc-arm-linux-gnueabi is the cross-toolchain package for the armel architecture. This toolchain implies the EABI generated by gcc's -mfloat-abi=soft or -mfloat-abi=softfp options. gcc-arm-linux

module_init() vs. core_initcall() vs. early_initcall()

半世苍凉 提交于 2019-11-28 03:50:16
In drivers I often see these three types of init functions being used. module_init() core_initcall() early_initcall() Under what circumstances should I use them? Also, are there any other ways of init? They determine the initialization order of built-in modules. Drivers will use device_initcall (or module_init ; see below) most of the time. Early initialization ( early_initcall ) is normally used by architecture-specific code to initialize hardware subsystems (power management, DMAs, etc.) before any real driver gets initialized. Technical stuff for understanding below Look at init/main.c .