Commit eadf8dce authored by Malay Keshav's avatar Malay Keshav Committed by Commit Bot

ozone: evdev: Switch to char[] for EVIOCGPHYS return

std::string is not used correctly with ioctl() and hence fails to get
the field info. Replace it with C string.

Bug: 827452
Change-Id: Iace6ce24a6405c40a68eeff71c090883b847a46f
Component: Event Device Info, phys
Reviewed-on: https://chromium-review.googlesource.com/1014409Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Commit-Queue: Malay Keshav <malaykeshav@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551381}
parent a052727f
...@@ -88,10 +88,8 @@ bool GetDeviceIdentifiers(int fd, ...@@ -88,10 +88,8 @@ bool GetDeviceIdentifiers(int fd,
} }
void GetDevicePhysInfo(int fd, const base::FilePath& path, std::string* phys) { void GetDevicePhysInfo(int fd, const base::FilePath& path, std::string* phys) {
std::string device_phys; char device_phys[kMaximumDeviceNameLength];
device_phys.reserve(kMaximumDeviceNameLength); if (ioctl(fd, EVIOCGPHYS(kMaximumDeviceNameLength - 1), &device_phys) < 0) {
if (ioctl(fd, EVIOCGPHYS(kMaximumDeviceNameLength - 1),
&device_phys.front()) < 0) {
PLOG(INFO) << "Failed EVIOCGPHYS (path=" << path.value() << ")"; PLOG(INFO) << "Failed EVIOCGPHYS (path=" << path.value() << ")";
return; return;
} }
......
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