Chromium Code Reviews| Index: ui/events/ozone/evdev/event_converter_evdev.cc |
| diff --git a/ui/events/ozone/evdev/event_converter_evdev.cc b/ui/events/ozone/evdev/event_converter_evdev.cc |
| index fce8e9ca3753da617928c10c52c40e9b27532698..0957829f94f29e662123df656acebe2114b83e24 100644 |
| --- a/ui/events/ozone/evdev/event_converter_evdev.cc |
| +++ b/ui/events/ozone/evdev/event_converter_evdev.cc |
| @@ -13,11 +13,34 @@ |
| namespace ui { |
| +namespace { |
| + // USB vendor and product strings are pragmatically limited to 126 |
| + // characters each, so device names more than twice that should be |
| + // unusual. |
| + const size_t kMaximumDeviceNameLength = 256; |
| +} // anonymous namespace |
| + |
| EventConverterEvdev::EventConverterEvdev(int fd, |
| const base::FilePath& path, |
| int id, |
| InputDeviceType type) |
| - : fd_(fd), path_(path), id_(id), type_(type), ignore_events_(false) { |
| + : fd_(fd), |
| + path_(path), |
| + input_device_(id, type, std::string()), |
| + ignore_events_(false) { |
| + char device_name[kMaximumDeviceNameLength]; |
| + if (ioctl(fd, EVIOCGNAME(kMaximumDeviceNameLength - 1), &device_name) < 0) { |
|
spang
2015/04/08 22:54:30
Can you move these to EventDeviceInfo? That's wher
kpschoedel
2015/04/09 18:51:41
Done.
|
| + PLOG(INFO) << "Can't read device name for " << id; |
| + } else { |
| + input_device_.name = device_name; |
| + } |
| + struct input_id evdev_id; |
| + if (ioctl(fd, EVIOCGID, &evdev_id) < 0) { |
| + PLOG(INFO) << "Can't read device identification for " << id; |
| + } else { |
| + input_device_.vendor_id = evdev_id.vendor; |
| + input_device_.product_id = evdev_id.product; |
| + } |
| } |
| EventConverterEvdev::~EventConverterEvdev() { |