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",
|
"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{
|
std::unordered_set<unsigned int> interestedUsage{
|
||||||
ACCELEROMETER_3D, GYROMETER_3D, COMPASS_3D, CUSTOM};
|
ACCELEROMETER_3D, GYROMETER_3D, COMPASS_3D, CUSTOM};
|
||||||
|
|
||||||
SP(HidRawDevice) device =
|
SP(HidRawDevice) device{new HidRawDevice(std::string(devicePath), interestedUsage)};
|
||||||
std::make_shared<HidRawDevice>(std::string(devicePath), interestedUsage);
|
|
||||||
const HidDevice::HidDeviceInfo &info = device->getDeviceInfo();
|
const HidDevice::HidDeviceInfo &info = device->getDeviceInfo();
|
||||||
|
|
||||||
LOG_V << "Sizeof descriptor: " << info.descriptor.size() << LOG_ENDL;
|
LOG_V << "Sizeof descriptor: " << info.descriptor.size() << LOG_ENDL;
|
||||||
|
@ -69,8 +68,8 @@ public:
|
||||||
// use HidRawSensor to operate the device, pick first digest
|
// use HidRawSensor to operate the device, pick first digest
|
||||||
//
|
//
|
||||||
auto &reportDigest = device->mDigestVector[0];
|
auto &reportDigest = device->mDigestVector[0];
|
||||||
SP(HidRawSensor) sensor = std::make_shared<HidRawSensor>(
|
SP(HidRawSensor) sensor{
|
||||||
device, reportDigest.fullUsage, reportDigest.packets);
|
new HidRawSensor(device, reportDigest.fullUsage, reportDigest.packets)};
|
||||||
|
|
||||||
if (!sensor->isValid()) {
|
if (!sensor->isValid()) {
|
||||||
LOG_E << "Sensor is not valid " << LOG_ENDL;
|
LOG_E << "Sensor is not valid " << LOG_ENDL;
|
||||||
|
|
Loading…
Reference in a new issue