drivers - What HID/Module does Air mouse use in Linux?
2014-07
I was thinking about developing a module for running a Air Mouse. I am not sure as what module s used to carry out the operation done by air mouse. Is it under HID? (I am talking about a wireless Air mouse so probably carries out interaction via sockets.)
I can understand the output of strace route -n
, but does route
really read any of the files in /proc
to get the routing table? Also, if the routes and IP addresses are stored under /proc
, why doesn't strace
show those files being accessed?
root@xxxx:/etc/postfix# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.21.58.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
0.0.0.0 10.21.58.1 0.0.0.0 UG 100 0 0 eth0
Edit, after more research:
It seems that route
does read a file under /proc
: specifically, /proc/net/route
. How, then, did the routing information get there?
The contents of files in the /proc
directory, or indeed any directory on which the proc
filesystem is mounted, is generated on the fly. The various filesystem related system calls are directed at the VFS layer in the Linux kernel to the proc code, which obtains the information from in-memory data structures inside the kernel memory space, formats them, masquerades them as the contents of those files.
Here is the file responsible for printing out the routing information for IPv4 in the kernel.
Yes, it does use /proc
, see that part of the strace route -n
output:
open("/proc/net/route", O_RDONLY) = 3
it reads all the information from there. The source of the information is the kernel itself. The kernel offers the routing information via files in the procfs
.
Files in /proc
are usually generated and filled (with information) by the kernel itself. Via this interface, the kernel can safely provide internal information to userland. In most cases, that is even human-readable.
The initial routing table is loaded from config files at boot time. Later you can manually add entries with the route
command. Also, routed
or gated
listens on the network for routing information and dynamically updates the routing table.