HidRawDeviceTest: Enable for device build
Test: $ adb shell hidrawdevice_test /dev/hidraw0 Bug: 265754293 Change-Id: I103ebc030f012d11e977fc155fc68f884f71f518
This commit is contained in:
parent
4ca44e7615
commit
b264eb4bd3
2 changed files with 28 additions and 4 deletions
|
@ -157,3 +157,28 @@ cc_binary_host {
|
|||
"test/HidRawDeviceTest.cpp",
|
||||
],
|
||||
}
|
||||
|
||||
//
|
||||
// Android device test for HidRawDevice and HidRawSensor
|
||||
//
|
||||
// Assuming lunch target 1
|
||||
// $ cd test
|
||||
// $ mma -j .
|
||||
// $ adb push $ANDROID_BUILD_TOP/out/target/product/generic/vendor/bin/hidrawdevice_test /vendor/bin
|
||||
// $ adb shell hidrawdevice_test /dev/hidraw0
|
||||
//
|
||||
cc_binary {
|
||||
name: "hidrawdevice_test",
|
||||
defaults: ["dynamic_sensor_defaults"],
|
||||
|
||||
srcs: [
|
||||
"test/HidRawDeviceTest.cpp",
|
||||
],
|
||||
|
||||
cflags: ["-DLOG_TO_CONSOLE=1"],
|
||||
|
||||
local_include_dirs: [
|
||||
"test",
|
||||
"HidUtils/test",
|
||||
],
|
||||
}
|
||||
|
|
|
@ -38,8 +38,7 @@ public:
|
|||
std::unordered_set<unsigned int> interestedUsage{
|
||||
ACCELEROMETER_3D, GYROMETER_3D, COMPASS_3D, CUSTOM};
|
||||
|
||||
SP(HidRawDevice) device =
|
||||
std::make_shared<HidRawDevice>(std::string(devicePath), interestedUsage);
|
||||
SP(HidRawDevice) device{new HidRawDevice(std::string(devicePath), interestedUsage)};
|
||||
const HidDevice::HidDeviceInfo &info = device->getDeviceInfo();
|
||||
|
||||
LOG_V << "Sizeof descriptor: " << info.descriptor.size() << LOG_ENDL;
|
||||
|
@ -69,8 +68,8 @@ public:
|
|||
// use HidRawSensor to operate the device, pick first digest
|
||||
//
|
||||
auto &reportDigest = device->mDigestVector[0];
|
||||
SP(HidRawSensor) sensor = std::make_shared<HidRawSensor>(
|
||||
device, reportDigest.fullUsage, reportDigest.packets);
|
||||
SP(HidRawSensor) sensor{
|
||||
new HidRawSensor(device, reportDigest.fullUsage, reportDigest.packets)};
|
||||
|
||||
if (!sensor->isValid()) {
|
||||
LOG_E << "Sensor is not valid " << LOG_ENDL;
|
||||
|
|
Loading…
Reference in a new issue