Commit 128013c0 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Add version field to ui::InputDevice

Linux's input_id offers version field in addition to bustype, vendor_id
and product_id. In USB spec, the field is called bcdDevice. In order to
improve gamepad support in ARC++, we will need the field in addition to
others.

TEST=manual
BUG=b:130597086

Change-Id: I6c47313b5d95b96787494fc782bc3090e6bb31e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1599758Reviewed-by: default avatarKevin Schoedel <kpschoedel@chromium.org>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659372}
parent a2573b05
......@@ -498,7 +498,7 @@ TEST_F(RecommendAppsFetcherImplTest, HasHardKeyboard) {
std::string("test external touch device"), gfx::Size(1920, 1200), 1)});
input_device_client_test_api_.SetKeyboardDevices(std::vector<ui::InputDevice>{
{1, ui::INPUT_DEVICE_INTERNAL, "internal keyboard", "phys",
base::FilePath("sys_path"), 0, 0}});
base::FilePath("sys_path"), 0, 0, 0}});
SetDisplaySize(gfx::Size(1920, 1200));
recommend_apps_fetcher_->Start();
......
......@@ -15,11 +15,11 @@ InputDevice::InputDevice()
: id(kInvalidId),
type(InputDeviceType::INPUT_DEVICE_UNKNOWN),
vendor_id(0),
product_id(0) {}
product_id(0),
version(0) {}
InputDevice::InputDevice(int id, InputDeviceType type, const std::string& name)
: id(id), type(type), name(name), vendor_id(0), product_id(0) {
}
: id(id), type(type), name(name), vendor_id(0), product_id(0), version(0) {}
InputDevice::InputDevice(int id,
InputDeviceType type,
......@@ -27,14 +27,16 @@ InputDevice::InputDevice(int id,
const std::string& phys,
const base::FilePath& sys_path,
uint16_t vendor,
uint16_t product)
uint16_t product,
uint16_t version)
: id(id),
type(type),
name(name),
phys(phys),
sys_path(sys_path),
vendor_id(vendor),
product_id(product) {}
product_id(product),
version(version) {}
InputDevice::InputDevice(const InputDevice& other) = default;
......
......@@ -34,7 +34,8 @@ struct EVENTS_DEVICES_EXPORT InputDevice {
const std::string& phys,
const base::FilePath& sys_path,
uint16_t vendor,
uint16_t product);
uint16_t product,
uint16_t version);
InputDevice(const InputDevice& other);
virtual ~InputDevice();
......@@ -62,6 +63,7 @@ struct EVENTS_DEVICES_EXPORT InputDevice {
// USB-style device identifiers, where available, or 0 if unavailable.
uint16_t vendor_id;
uint16_t product_id;
uint16_t version;
};
} // namespace ui
......
......@@ -26,7 +26,8 @@ EventConverterEvdev::EventConverterEvdev(int fd,
const std::string& name,
const std::string& phys,
uint16_t vendor_id,
uint16_t product_id)
uint16_t product_id,
uint16_t version)
: fd_(fd),
path_(path),
input_device_(id,
......@@ -35,7 +36,8 @@ EventConverterEvdev::EventConverterEvdev(int fd,
phys,
GetInputPathInSys(path),
vendor_id,
product_id),
product_id,
version),
controller_(FROM_HERE) {
input_device_.enabled = false;
}
......
......@@ -33,7 +33,8 @@ class EVENTS_OZONE_EVDEV_EXPORT EventConverterEvdev
const std::string& name,
const std::string& phys,
uint16_t vendor_id,
uint16_t product_id);
uint16_t product_id,
uint16_t version);
~EventConverterEvdev() override;
int id() const { return input_device_.id; }
......
......@@ -43,7 +43,8 @@ EventConverterEvdevImpl::EventConverterEvdevImpl(
devinfo.name(),
devinfo.phys(),
devinfo.vendor_id(),
devinfo.product_id()),
devinfo.product_id(),
devinfo.version()),
input_device_fd_(std::move(fd)),
has_keyboard_(devinfo.HasKeyboard()),
has_touchpad_(devinfo.HasTouchpad()),
......
......@@ -97,6 +97,7 @@ class EVENTS_OZONE_EVDEV_EXPORT EventDeviceInfo {
uint16_t bustype() const { return input_id_.bustype; }
uint16_t vendor_id() const { return input_id_.vendor; }
uint16_t product_id() const { return input_id_.product; }
uint16_t version() const { return input_id_.version; }
// Check input device properties.
bool HasProp(unsigned int code) const;
......
......@@ -101,7 +101,8 @@ GamepadEventConverterEvdev::GamepadEventConverterEvdev(
devinfo.name(),
devinfo.phys(),
devinfo.vendor_id(),
devinfo.product_id()),
devinfo.product_id(),
devinfo.version()),
will_send_frame_(false),
last_hat_left_press_(false),
last_hat_right_press_(false),
......
......@@ -39,7 +39,8 @@ EventReaderLibevdevCros::EventReaderLibevdevCros(
devinfo.name(),
devinfo.phys(),
devinfo.vendor_id(),
devinfo.product_id()),
devinfo.product_id(),
devinfo.version()),
has_keyboard_(devinfo.HasKeyboard()),
has_mouse_(devinfo.HasMouse()),
has_touchpad_(devinfo.HasTouchpad()),
......
......@@ -43,7 +43,8 @@ TabletEventConverterEvdev::TabletEventConverterEvdev(
info.name(),
info.phys(),
info.vendor_id(),
info.product_id()),
info.product_id(),
info.version()),
input_device_fd_(std::move(fd)),
controller_(FROM_HERE),
cursor_(cursor),
......
......@@ -126,7 +126,8 @@ TouchEventConverterEvdev::TouchEventConverterEvdev(
devinfo.name(),
devinfo.phys(),
devinfo.vendor_id(),
devinfo.product_id()),
devinfo.product_id(),
devinfo.version()),
input_device_fd_(std::move(fd)),
dispatcher_(dispatcher) {
touch_evdev_debug_buffer_.Initialize(devinfo);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment