LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 03-08-2019, 07:11 PM   #1
peterg17
LQ Newbie
 
Registered: Jun 2018
Location: Sydney, Australia
Distribution: Ubuntu
Posts: 27

Rep: Reputation: Disabled
How to open an input-polldev device from userspace


I am attempting to get the drivers/hwmon/mxc_mma8451 i2c driver happenning.

This driver invokes input_register_polled_device. When it operates, it creates a directory structure at /sys/devices/virtual/input/inputN (where N is a number.)

When the module loads, it does about 3 polls, then stops, going into standby mode.
There is an "enable" file. I tried writing 1 to it, but this does not cause polling to resume.

Looking at the code in input-polldev.c, polling should be enabled if the device is "opened", or rather the function pointer dev->open is invoked, where dev is the argument to input_register_polled_device.

I have trawled through many kernel files that invoke input_register_polled_device. None of them invoke "open", or even include the string "open" in their code. So my question is, what file from userspace is opened to get the open function to run?

I would also appreciate a link to any documentation on this subject.
 
Old 03-09-2019, 08:08 AM   #2
peterg17
LQ Newbie
 
Registered: Jun 2018
Location: Sydney, Australia
Distribution: Ubuntu
Posts: 27

Original Poster
Rep: Reputation: Disabled
I stumbled on the answer eventually.
Upon module installation, a message appears in dmesg such as
[ 2836.524031] input: mma8451 as /devices/virtual/input/input2
This corresponds to /sys/devices/virtual/input/input2. In a subdirectory, there is a file event0/uevent.
The contents of this file are:

$ cat /sys/devices/virtual/input/input2/event0/uevent
MAJOR=13
MINOR=64
DEVNAME=input/event0

And opening /dev/input/event0 from python say caused polling to commence.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing network device hardware register in userspace zctee Linux - Kernel 2 02-01-2015 06:23 PM
mapping device memory to userspace in embeded environment in coldfire processor clnbabu Linux - Kernel 5 10-03-2011 02:17 PM
Mount userspace directory as "/dev" block device for USB Gadget API? Robert_A Programming 5 02-17-2011 02:26 AM
Repeated "input: AT Translated Set 2 keyboard as /class/input/input" messages AcerKev Mandriva 2 09-16-2007 08:35 AM
Help with converting a userspace PCI program to a Device Driver cstrask Linux - Hardware 0 10-31-2005 09:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 09:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration