Files in /proc
do not have a file size in general, and are shown as having 0 size in ls -l
, but you can read data from them anyway (see man 5 proc
).
Try, for example:
zcat /proc/config.gz | wc
or:
$ ls -l /proc/cmdline
-r--r--r-- 1 root root 0 Aug 4 10:16 /proc/cmdline
Looks empty. But:
$ cat /proc/cmdline | wc
1 5 114
it contains data. Let's see:
$ cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-3.13.0-24-generic root=UUID=fc48808f-8f06-47fc-a1fe-5d08ee9e0a50 ro noirqdebug nomodeset
feels like a normal file - except if you want to do anything special, like reading by blocks, seek(), or loking at the size.
In case you can not read /proc/config.gz
, there is a file that normally contains the same:
less /lib/modules/$(uname -r)/build/.config
See man proc
for details.
Best Answer
It represent the
bitmask
for events supported by the device.Sample of
devices
entry for a AT Keyboard:The
B
in front stands forbitmap
,N
,P
,S
,U
,H
are simply first letter in corresponding name value andI
is forID
. In ordered fashion:I => @id: id of the device
(struct input_id)
Bus => id.bustype
Vendor => id.vendor
Product => id.product
Version => id.version
N => name of the device.
P => physical path to the device in the system hierarchy.
S => sysfs path.
U => unique identification code for the device (if device has it).
H => list of input handles associated with the device.
B => bitmaps
PROP => device properties and quirks.
EV => types of events supported by the device.
KEY => keys/buttons this device has.
MSC => miscellaneous events supported by the device.
LED => leds present on the device.
Bitmasks
As you know computers deal in binary, so:
So if i have a bitmap with value
5
that one would hold bits 0 and 2 in other word one can give each number a name and check if they correspond to a value.E.g.
Then if I have
MYVAR = 5
which is101
in binary this would check out:Thus my var has A and C.
The kernel uses a bit more sophisticated/complex way, and set bits by offset. One reason being that more bits then is available in one computer (CPU) integer is used. For example look at the
KEY
bitmap.So, if we say:
And then
Decoding
120013
The value
120013
is a hexadecimal. As binary it gives us:Numbered from right they are:
Then check
input-event-codes.h
you find that they correspond to:To check what they mean a quick introduction is given by Kernel documentation.
This, "EDIT 2 (continued):" in particular, might be of interest.