linux-device-driver

outb() does not work in LDD3 example short module

 ̄綄美尐妖づ 提交于 2020-01-07 03:28:08
问题 I am trying short.c in examples of Linux Device Driver 3 My PC has Parallel Port and after the Ubuntu boots up, I can see these: cat /proc/ioports 0378-037a : parport0 037b-037f : parport0 outp 0x378 1 (outp is another example in LDD3 which write data to ports) the LED on the port is ON. Then I run these commands to remove modules rmmod lp rmmod parport_pc cat /proc/ioports (There is no module on 0378-037f any more.) I run this again but the LED is not ON this time. outp 0x378 1 Then I

Linux device driver for a Smart Card IC module

这一生的挚爱 提交于 2020-01-06 07:12:42
问题 I have a smart card IC module, and I want to create a Linux device driver for it. This module is using SPI as the controlling line and has an interrupt line to indicate whether a card is ready. I know how to create a SPI device in Linux kernel and how to read data in the kernel when the interruption happens. But I have no idea on how to transfer the data to the user space (maybe need to create a device node for it), and how to give the user space a interruption to notify it. Does anyone have

How to get data segment of Linux kernel from LKM

廉价感情. 提交于 2020-01-06 04:06:31
问题 I'm writing a kernel module which involves the tasklist_lock , __bss_start . These symbols are not exported. I'm pretty sure even if not exported, we can access the symbols from text sections using kernsym_lookup_name() Reference How my custom module on linux 3.2.28 can make a call to print_cpu_info? $ vim System.map ... 80017be0 T register_undef_hook 80017c28 T unregister_undef_hook 80017c70 T do_unexp_fiq ... 806eb000 D mmlist_lock 806eb040 D tasklist_lock 806eb080 d softirq_vec .... T

freescale imx6 with mpu9250

烂漫一生 提交于 2020-01-04 07:52:12
问题 I am trying to interface freescale imx6 SoC with mpu92/65 sensor device. I have taken mpu92/65 device driver from android (https://github.com/NoelMacwan/Kernel-10.4.1.B.0.101/tree/master/drivers/staging/iio/imu ) and have done necessary modifications to the driver and device tree. Device tree modifications: &i2c3{ ... extaccelerometer: mpu9250@68{ compatible = "mpu9250"; reg = <0x68>; interrupt-parent = <&gpio2>; interrupts = <9>; int_config = /bits/ 8 <0x00>; level_shifter = /bits/ 8 <0>;

How to get lid state using linux kernel module?

微笑、不失礼 提交于 2020-01-04 02:21:24
问题 I can read the status of my laptop lid by reading /proc/acpi/button/lid/LID0/state file. Now I want to read it from kernel module. I found the source file drivers/acpi/button.c in kernel source. But still I didn't understand how to use it. It exporting acpi_lid_notifier_register, acpi_lid_notifier_unregiste and acpi_lid_open functions. How to write a module for lid state? 回答1: acpi_lid_open returns 0 (closed), 1 (open), or a negative error number (unsupported). To use the notifier, you would

Linux Kernel: Is it OK to leave a streaming DMA mapping open indefinitely?

孤人 提交于 2020-01-03 15:16:08
问题 Many guides on device driver programming suggest that streaming DMA mappings (i.e. those created by dma_map_single() and friends), be held open for as short a time as possible, as they consume resources (i.e. IOMMU mapping resources if the platform has one, or a bounce buffer when required). In my case, I'm working with a PCIe device capable of 64-bit DMA, so a bounce buffer should be unnecessary (and it doesn't seem like special treatment from the IOMMU is required in this case either,

Is there any way for ioctl() in linux to specify submission queue ID for a nvme IO request

戏子无情 提交于 2020-01-03 05:07:46
问题 I am working on a testing tool for nvme-cli(written in c and can run on linux). For SSD validation purpose, we are actually looking for sending I/O commands to a particular Submission queue(IO Queue pair). We needed this because we wanted threading, but for threading to happen we need to send I/O requests to different queues else the I/O requests would be processed serially. So is there any way in ioctl() where we can specify the Submission queue IDs? Here is how a nvme IO is requested with

How to communicate with the USB Host from a Linux USB Client

眉间皱痕 提交于 2020-01-03 03:44:26
问题 The host part will be a PC program made from c# in which I will use LibUSBdotnet to do the communication. My problem is how do I make the Linux side pickup and respond. I don't really know where to start. Whenever I try to search for it, all result show are "how linux communicates with a device attached to it". Or it does not matter if a device is host or client, because they utilize the same pipes/bus? Can I use something in "/dev/usb***"? I have seen "libusb" which I believe is the linux

how to make kernel module binary blob

萝らか妹 提交于 2020-01-02 15:04:52
问题 I want to distribute proprietary Linux module for various distros without pre-building the module for all of them. For example I have the following files: wrapp.c mod.c fops.c All wrapp.c is wrapper for all kernel functions I'm using: unsigned int wrap_ioread8(void *addr) { return ioread8(addr); } What I want to do is to give the customer mod.o and fops.o + the wrapp.c. So I build the mod/fops.o on kernel 3.2 then tried to use them on kernel 2.6.32. The module builds without a problem but

P1010 MAC to Switch port direct connection without PHY

爱⌒轻易说出口 提交于 2020-01-02 09:55:44
问题 I have a custom board with freescale P1010 processor in which P1010's eTSEC2 ( Enhanced 3-speed Ethernet controller) port is directly connected to Marvell 88E6046 ethernet switch Port 9 in SGMII mode. Linux (3.17) DSA driver is able to probe and detect switch ( Port 9 is 'cpu' whereas port 0 and 1 are designated as 'lan1' and 'lan2'). The problem however is, that there is no PHY for switch to attach to ( 'ifconfig up' fails to attach to ethx). U-boot creates a 'generic PHY' eth0 since it