linux-device-driver

insmod error “unknown symbol in module”

梦想的初衷 提交于 2019-12-12 05:12:05
问题 I am writing parallel LED board driver, .ko is successfully generated. I am facing this issue [63722.594233] led: Unknown symbol parport_register_device (err 0) [63722.594264] led: Unknown symbol parport_register_driver (err 0) 回答1: parport_register_device is exported in drivers/parport/share.c. So you have to load parport driver first ( modprobe parport ) and then your driver. 来源: https://stackoverflow.com/questions/22954268/insmod-error-unknown-symbol-in-module

Is there a way to have a ioctl() with new(customized) command

故事扮演 提交于 2019-12-12 05:04:47
问题 I am working on a testing tool for nvme-cli(written in c and can run on linux). For SSD validation purpose, i was actually looking for a custom command(For e.g. I/O command, write and then read the same and finally compare if both the data are same) In user space i need to invoke minimum of 2 ioclt() one with write command(nvme_cmd_write) and another with read command(nvme_cmd_read) and compare both the buffer contents. Issue is actually when i wanted to send this command in parallel. At

How to read child node property in a device tree

不问归期 提交于 2019-12-12 04:54:50
问题 I been trying to read child node property in a device tree.. Could not figured it out, can any one help here. I have a dts AA{ child 1: { property 1 : XXX property 2 : XXX } child 2 :{ property 1 : XXX property 2 : XXX } BB{ child 1: { property 1 : XXX property 2 : XXX } child 2 :{ property 1 : XXX property 2 : XXX } Is there any way of reading properies of child 2 in AA node of given dts ? 回答1: Yes, you can do it. Just write a similar function as below and call it in AA with the path of the

maximum allocated memory by linux-kernel module

南楼画角 提交于 2019-12-12 04:14:40
问题 I want to write a module whose task is to capture the incoming packets without sending them to the user space application & doing some modification on the captured packet. then this module will send this packet for transmission to the NIC. But main problem is that my module is very big in size & it also does a lot of processing. So will it be good to do this processing inside kernel module or should we pass the information & packet to the user space for processing to avoid complexity. & i m

Read EEPROM entry from linux module

筅森魡賤 提交于 2019-12-12 03:49:45
问题 I'm writing a linux driver for a custom RF board. The RF board have an EEPROM contain some information and I want to load this information to my driver. Linux kernel already has EEPROM module, this module read all memory of the EEPROM and export to userspace by sysfs. Can I read this sysfs to get EEPROM's memory? If not, how can I get this information? Thank you. 回答1: There are userspace applications which read the data exported by the eeprom module. So if you know Perl a bit, I suggest that

Getting the value of bitrate from a wireless device driver.

≡放荡痞女 提交于 2019-12-12 03:42:06
问题 I'm writing a kernel module that needs to read the value of bitrate from this union: union iwreq_data {== ....... struct iw_param bitrate; /* default bit rate */ .... } This code is form wireless.h Does anyone know how I can access it's value? (I'm using linux kernel 2.6.35) 回答1: There's no way to do that, unfortunately ... taking a closer look at the iw_param struct we find struct iw_param { __s32 value; /* The value of the parameter itself */ __u8 fixed; /* Hardware should not use auto

check if the mapped memory supports write combining

余生长醉 提交于 2019-12-12 03:37:23
问题 I write a kernel driver which exposes to the user space my I/O device. Using mmap the application gets virtual address to write into the device. Since i want the application write uses a big PCIe transaction, the driver maps this memory to be write combining. According to the memory type (write-combining or non-cached) the application applies an optimal method to work with the device. But, some architectures do not support write-combining or may support but just for part of the memory space.

Add SPI slave device in linux 4.9 device tree for raspbery pi

早过忘川 提交于 2019-12-12 03:27:26
问题 I am writing mcp3008 driver without use of iio for learnings. At this stage i want driver's probe to be called. I have appended my code in DT arch/arm/boot/dts/bcm2708-rpi-b.dts &spi0 { pinctrl-names = "default"; pinctrl-0 = <&spi0_pins &spi0_cs_pins>; cs-gpios = <&gpio 8 1>, <&gpio 7 1>; spidev0: spidev@0{ compatible = "spidev"; reg = <0>; /* CE0 */ #address-cells = <1>; #size-cells = <0>; spi-max-frequency = <500000>; }; spidev1: spidev@1{ compatible = "spidev"; reg = <1>; /* CE1 */

A simple program on linux device driver

我的梦境 提交于 2019-12-12 02:53:55
问题 include #include<linux/module.h> #include<linux/init.h> int my_init(void){ printk("<1> Angus : Module Insertion is successful!"); return 0; } void my_cleanup(void){ printk("<1> Angus : Module unloading successful!"); } module_init(my_init); module_cleanup(my_cleanup); Makefile : obj-m:=simple.o aoll: make -C /usr/src/linux-headers-3.2.0-25-generic-pae/ M=$(PWD) modules clean: make -C /usr/src/linux-headers-3.2.0-25-generic-pae/ M=$(PWD) clean make -C => will change to the directory before

linux non-standard serial console

橙三吉。 提交于 2019-12-12 02:48:32
问题 I am porting linux to one of the custom architectures. My serial console is unconventional, in the sense it does not work on interrupts. I am trying to output messages from linux boot process onto kernel console. I used register_console and printk started working. Now I can see kernel printk messages being printed on console. Now I am trying to get messages from the user space process onto console. I was under the impression that console registered for kernel will also work for user processes