Linux programs that communicate with devices

I can program, but I know little about computers. I am using Ubuntu Linux, and I understand (at first glance) which device files. What I would like to do is write a program that takes raw input from a device, for example. mouse, keyboard, webcam or microphone. I don’t know where to start. There is a book called Linux Device Drivers, but I don’t know if all the information contained in this thick book is important. I do not want to write device drivers, although if it is necessary for what I want to do, I will do it. But rather, I just want to write a C ++ or (preferably) Python program that takes raw data from devices and does other things with the original input. Can someone please tell me where to start? What textbooks or books should I read?

Am I just opening device files and reading them? I could try, but another problem arises here. I do not know which device is in the / dev / directory! I have a Logitec air mouse that connects via Bluetooth to a receiver, which in turn connects to a computer via USB. But which device file should I open if I want to receive raw data from my mouse? Will it be a USB device file or a mouse device file? There are many device files in my / dev / directory that can match my mouse, which one? I have / dev / input / mouse 0, / dev / input / mouse1, etc., and / dev / input / mice, and / dev / input / event0, / dev / input / event1, etc. So many of them? Which one is correct? How to find out?

Sorry, but I'm just very upset and confused about where to start. Any help would be greatly appreciated.

+3
source share
3 answers

Thanks to the ninjali for his / her answer, there were no detailed answers that really solve my problem. This is understandable, of course, because the question was not very well formulated, and it is an unusual thing to ask anyway in my impression.

So, after some research, I am going to answer my own problem in the hope that someone else will be interested or have the same problems as me, they can get the answer here.

? Advanced Linux Programming. , , Open Publication. 6, "", . , , , , .

? . , , , " " " ", . ls -l . , . , . , , Linux. , , Linux, . , /dev/ , , /dev/dvd. , , !

+4

/dev/input/event* evdev. /dev/input/mouse* , - PS/2.

+1

, //, Linux. , , linux . , . /sys directory dmesg, , node , . "cat/proc/devices", Major/Minor no. .

0

All Articles