#include "services/device/hid/input_service_linux.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/threading/sequence_bound.h"
#include "device/udev_linux/scoped_udev.h"
#include "device/udev_linux/udev_watcher.h"
namespace device {
namespace {
const char kSubsystemHid[] = …;
const char kSubsystemInput[] = …;
const char kSubsystemMisc[] = …;
const char kTypeBluetooth[] = …;
const char kTypeUsb[] = …;
const char kTypeSerio[] = …;
const char kIdInputAccelerometer[] = …;
const char kIdInputJoystick[] = …;
const char kIdInputKey[] = …;
const char kIdInputKeyboard[] = …;
const char kIdInputMouse[] = …;
const char kIdInputTablet[] = …;
const char kIdInputTouchpad[] = …;
const char kIdInputTouchscreen[] = …;
InputServiceLinux* g_input_service_linux = …;
bool GetBoolProperty(udev_device* device, const char* key) { … }
mojom::InputDeviceType GetDeviceType(udev_device* device) { … }
std::string GetParentDeviceName(udev_device* device, const char* subsystem) { … }
class InputServiceLinuxImpl : public InputServiceLinux { … };
class InputServiceLinuxImpl::BlockingTaskRunnerHelper
: public UdevWatcher::Observer { … };
InputServiceLinuxImpl::InputServiceLinuxImpl() { … }
InputServiceLinuxImpl::~InputServiceLinuxImpl() { … }
void InputServiceLinuxImpl::BlockingTaskRunnerHelper::OnDeviceAdded(
ScopedUdevDevicePtr device) { … }
void InputServiceLinuxImpl::BlockingTaskRunnerHelper::OnDeviceRemoved(
ScopedUdevDevicePtr device) { … }
void InputServiceLinuxImpl::BlockingTaskRunnerHelper::OnDeviceChanged(
ScopedUdevDevicePtr device) { … }
}
InputServiceLinux::InputServiceLinux() = default;
InputServiceLinux::~InputServiceLinux() { … }
void InputServiceLinux::BindReceiver(
mojo::PendingReceiver<mojom::InputDeviceManager> receiver) { … }
InputServiceLinux* InputServiceLinux::GetInstance() { … }
bool InputServiceLinux::HasInstance() { … }
void InputServiceLinux::SetForTesting(
std::unique_ptr<InputServiceLinux> service) { … }
void InputServiceLinux::AddReceiver(
mojo::PendingReceiver<mojom::InputDeviceManager> receiver) { … }
void InputServiceLinux::GetDevicesAndSetClient(
mojo::PendingAssociatedRemote<mojom::InputDeviceManagerClient> client,
GetDevicesCallback callback) { … }
void InputServiceLinux::GetDevices(GetDevicesCallback callback) { … }
void InputServiceLinux::AddDevice(mojom::InputDeviceInfoPtr info) { … }
void InputServiceLinux::RemoveDevice(const std::string& id) { … }
}