blob: 4cc1a776c010788744af18d64060a10749e0cde3 [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