MCPcopy Create free account
hub / github.com/USBGuard/usbguard / ueventProcessUEvent

Method ueventProcessUEvent

src/Library/UEventDeviceManager.cpp:313–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311 }
312
313 void UEventDeviceManager::ueventProcessUEvent(UEvent uevent)
314 {
315 const std::string subsystem = uevent.getAttribute("SUBSYSTEM");
316 const std::string devtype = uevent.getAttribute("DEVTYPE");
317 const std::string action = uevent.getAttribute("ACTION");
318
319 /*
320 * We don't care about the event if it's not from the "usb" subsystem.
321 * The device type attribute value is checked later based on the data
322 * read from the sysfs uevent file in the device directory.
323 */
324 if (subsystem != "usb") {
325 USBGUARD_LOG(Debug) << "Ignoring non-USB device:"
326 << " subsystem=" << subsystem
327 << " devtype=" << devtype
328 << " action=" << action;
329 return;
330 }
331
332 const std::string sysfs_devpath = uevent.getAttribute("DEVPATH");
333
334 if (_enumeration) {
335 _backlog.emplace_back(std::move(uevent));
336 }
337 else {
338 ueventProcessAction(action, sysfs_devpath);
339 }
340 }
341
342 void UEventDeviceManager::ueventProcessAction(const std::string& action, const std::string& sysfs_devpath)
343 {

Callers

nothing calls this directly

Calls 1

getAttributeMethod · 0.80

Tested by

no test coverage detected