linux-device-driver

MCP23017 I2C Device driver probe function is not called

ぃ、小莉子 提交于 2019-12-06 07:57:56
I am using the following I2C/GPIO Device driver to access the MCP23017 GPIOs. With the insmod command I am able to load the driver and its listed in /proc/modules. I have two MCP23017 chips connected to my Raspberry Pi. Both are detected at addresses 0x20 and 0x21 . The initcall to the driver registers the driver. I checked this by printing out a message. But the driver probe function is not called. The devices are not opened/ cannot be located elsewhere. How is the probe function called? Should the probe be done manually to locate the devices? Is the probe call similar to the open call? I

How Kernel stack is used in case of different processor mode in ARM architecture?

ε祈祈猫儿з 提交于 2019-12-06 07:52:28
问题 As I understand every process have a user stack and kernel stack. Apart from that there is a stack for every mode in ARM achitecture. So I want to know How different stack and stack pointer works in ARM modes? Also when this kernel stack associated with the process will be used ? 回答1: ... when this kernel stack associated with the process will be used ? When you make a system call. Like you want to get IP address of an interface, kernel just like any other application needs some stack to

P1010 MAC to Switch port direct connection without PHY

倾然丶 夕夏残阳落幕 提交于 2019-12-06 07:02:34
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 finds there is something ( switch ) attached to processor P1010 but when Linux is up and switch is attached

BBB DT based approach

試著忘記壹切 提交于 2019-12-06 06:25:01
问题 I have successfully implemented a GPIO based driver for my custom protocol using platform device model. I want to upgrade it using device tree approach. So for starters I have a beaglebone black, and I have cross compiled the kernel using the device tree config enabled and verified during uboot console messages showing Verifying Checksum ... OK Flattened Device Tree blob at 80f80000 Booting using the fdt blob at 0x80f80000 XIP Kernel Image ... OK OK Using Device Tree in place at 80f80000, end

How to get current process's UID and EUID in Linux Kernel 4.2?

自古美人都是妖i 提交于 2019-12-06 05:37:01
问题 As LDD3 chapter 6 p175 show, we can get current process UID and EUID by current->uid and current->euid . But the definition of struct task_struct of Linux Kernel 4.2 don't contain fields named by uid or euid any more. So, I wonder if there are any other methods to get UID and EUID ? Thanks! 回答1: .uid and .euid fields were moved to struct cred , which is now exposed as .cred field in struct task_struct . It was done in this commit: CRED: Separate task security context from task_struct. If you

Is low latency mode safe to use with Linux serial ports?

廉价感情. 提交于 2019-12-06 05:11:18
问题 Is it safe to use the low_latency tty mode with Linux serial ports? The tty_flip_buffer_push function is documented that it "must not be called from IRQ context if port->low_latency is set." Nevertheless, many low-level serial port drivers call it from an ISR whether or not the flag is set. For example, the mpc52xx driver calls flip buffer unconditionally after each read from its FIFO. A consequence of the low latency flip buffer in the ISR is that the line discipline driver is entered within

Source code of keyboard driver of linux

有些话、适合烂在心里 提交于 2019-12-06 05:02:41
问题 I have been working on making my own keyboard driver for linux. So I came accross these two links: usbkbd.c and atkbd.c. Now I am confused which of these is the actual code driving my keyboard at the present. As I see it atkbd.c is quite gory and there is a conversion of scancodes to keycodes. So it should be the code, though I am not sure. If atkbd.c is the code, then what is the other code for? 回答1: This is easy to check. Let's take usbkbd.c. The corresponding Kconfig (http://lxr.free

How to create a virtual device in linux?

假装没事ソ 提交于 2019-12-06 04:39:10
问题 My question is pretty much the same as - How to create a virtual file? except I want to do it in Linux instead. I imagine what I need to do is create a virtual device and point the application logging to that device. I'd like to write the device in python or ruby or something else interpreted, if possible. 回答1: check out named pipes http://en.wikipedia.org/wiki/Named_pipe 回答2: Use mknod. You can create a socket file which your apps can write too. And your logging app would connect to the

How can I shrink the Linux page cache from within kernel space?

家住魔仙堡 提交于 2019-12-06 04:28:25
问题 I'm working on a system that involves some custom hardware and a custom Linux device driver I wrote for the hardware. The system occasionally needs to move large amounts of data very rapidly and therefore my driver dynamically (i.e. when needed) allocates large (1 GB) DMA buffers which are used and then freed when they are no longer needed. To allocate such large buffers I actually allocate a bunch of smaller buffers (256 X 4MB) using dma_alloc_coherent and then map them contiguously into

Using Linux virtual mouse driver

匆匆过客 提交于 2019-12-06 04:10:21
问题 I am trying to implement a virtual mouse driver according to the Essential Linux device Drivers book. There is a user space application, which generates coordinates as well as a kernel module. See: Virtual mouse driver and userspace application code and also a step by step on how to use this driver. 1.) I compile the code of the user space application and driver. 2.) Next i checked dmesg output and have, input: Unspecified device as /class/input/input32 Virtual Mouse Driver Initialized 3.)