Here I extracted from the application my code for detecting USB devices that I have used so far: //Initialize udev structures. This code starts working when I manually modify a file. I know that I can write an udev rule similar to this one: ACTION="add", SUBSYSTEMS="usb", RUN+="/bin/sh -c 'for host in /sys/bus/usb/devices/usb* do echo 0 > $host/authorized_default done'"īut when I add this rule, I cannot use rest of my code based on libudev. If user wants to accept it, I want to use this device. I need to block all USB devices by default, get their vid and pid and ask user for accepting this device. The code works fine, but now I would like to modify it a bit. I am using libudev library to detect new devices and get some pieces of information about them, such name, vid, pid and serial number. I am writing an application in C++ on Linux (Ubuntu) that can detect plugging USB devices.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |