MCPcopy Create free account
hub / github.com/canonical/mir / device_for_path

Function device_for_path

tests/unit-tests/input/evdev/test_evdev_input_platform.cpp:54–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52};
53
54std::shared_ptr<udev_device> device_for_path(char const* devnode)
55{
56 auto ctx = std::make_shared<mu::Context>();
57 mu::Enumerator devices{ctx};
58
59 devices.scan_devices();
60
61 for (auto const& device : devices)
62 {
63 if (device.devnode() && strcmp(device.devnode(), devnode) == 0)
64 {
65 return device.as_raw();
66 }
67 }
68
69 BOOST_THROW_EXCEPTION((
70 std::runtime_error{
71 std::string{"Failed to find udev device for "} + devnode}));
72}
73
74struct EvdevInputPlatform : public ::testing::TestWithParam<std::string>
75{

Callers 2

EvdevInputPlatformMethod · 0.85
TEST_FFunction · 0.85

Calls 3

scan_devicesMethod · 0.80
devnodeMethod · 0.80
as_rawMethod · 0.80

Tested by

no test coverage detected