blob: 95c6096154079ee9a49d020fefd87e3f6b0cb337 [file] [log] [blame]
// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "permission_broker/usb_subsystem_udev_rule.h"
#include <libudev.h>
#include <string.h>
#include <string>
using std::string;
namespace permission_broker {
UsbSubsystemUdevRule::UsbSubsystemUdevRule(const string& name) : Rule(name) {
Rule::Result UsbSubsystemUdevRule::ProcessDevice(struct udev_device* device) {
const char* const subsystem = udev_device_get_subsystem(device);
if (!subsystem || strcmp(subsystem, "usb"))
return IGNORE;
return ProcessUsbDevice(device);
} // namespace permission_broker