Add some samsung cmds

This commit is contained in:
Pierre-Hugues Husson 2022-04-11 08:26:21 -04:00
parent 817b1903e7
commit d4520330a6
4 changed files with 106 additions and 2 deletions

View File

@ -189,6 +189,7 @@ cc_binary {
"sec-camera-list.cpp",
],
shared_libs: [
"vendor.samsung.hardware.camera.provider@4.0",
"vendor.samsung.hardware.camera.provider@3.0",
"libutils",
"libhidlbase",
@ -211,3 +212,32 @@ cc_binary {
"xiaomi-touch.cpp",
],
}
cc_binary {
name: "sec-ril",
srcs: [
"sec-ril.cpp",
],
shared_libs: [
"android.hardware.radio@1.6",
"vendor.samsung.hardware.radio@2.0",
"vendor.samsung.hardware.radio@2.1",
"vendor.samsung.hardware.radio@2.2",
"libutils",
"libhidlbase",
],
}
cc_binary {
name: "sec-torch",
srcs: [
"sec-torch.cpp",
],
shared_libs: [
"vendor.samsung.hardware.camera.provider@4.0",
"vendor.samsung.hardware.camera.provider@3.0",
"vendor.samsung.hardware.camera.device@5.0",
"libutils",
"libhidlbase",
],
}

View File

@ -1,7 +1,7 @@
#include <iostream>
#include <vendor/samsung/hardware/camera/provider/3.0/ISehCameraProvider.h>
#include <vendor/samsung/hardware/camera/provider/4.0/ISehCameraProvider.h>
using ::vendor::samsung::hardware::camera::provider::V3_0::ISehCameraProvider;
using ::vendor::samsung::hardware::camera::provider::V4_0::ISehCameraProvider;
using ::android::sp;
int main(int argc, char **argv) {

37
cmds/sec-ril.cpp Normal file
View File

@ -0,0 +1,37 @@
#include <iostream>
#include <stdint.h>
#include <vector>
#include <vendor/samsung/hardware/radio/2.2/ISehRadio.h>
#include <android/hardware/radio/1.6/IRadio.h>
using ::vendor::samsung::hardware::radio::V2_2::ISehRadio;
using ::android::hardware::radio::V1_6::IRadio;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = ISehRadio::getService(argv[1]);
//setNrMode
#if 0
android::hardware::hidl_vec<uint8_t> cmd = {
2, 131, 0, 5, (uint8_t)atoi(argv[2]),
};
svc->sendRequestRaw(5556, cmd);
svc->setNrMode(5555, atoi(argv[1]));
#endif
#if 0
//notifyRilConnected
android::hardware::hidl_vec<uint8_t> cmd = {
11,24,0,5,0,
};
svc->sendRequestRaw(5556, cmd);
#endif
svc->setNrMode_2_2(5555, atoi(argv[2]), true);
#if 0
auto svcRadio = IRadio::getService(argv[1]);
svcRadio->setAllowedNetworkTypesBitmap(4444, 0x1bfffe);
svcRadio->setPreferredNetworkTypeBitmap(4443, 0x1bfffe);
#endif
}

37
cmds/sec-torch.cpp Normal file
View File

@ -0,0 +1,37 @@
#include <iostream>
#include <vendor/samsung/hardware/camera/provider/4.0/ISehCameraProvider.h>
#include <vendor/samsung/hardware/camera/device/5.0/ISehCameraDevice.h>
using ::vendor::samsung::hardware::camera::provider::V4_0::ISehCameraProvider;
using ::android::sp;
int main(int argc, char **argv) {
auto svc = ISehCameraProvider::getService("legacy/0");
android::hardware::camera::common::V1_0::Status status;
android::sp<android::hardware::camera::device::V3_2::ICameraDevice> camera_old;
android::hardware::Return<void> ret = svc->getCameraDeviceInterface_V3_x(argv[3], [&status, &camera_old](android::hardware::camera::common::V1_0::Status s, android::sp<android::hardware::camera::device::V3_2::ICameraDevice> intf) {
status = s;
if(intf == nullptr) {
fprintf(stderr, "Failed getting camera intf\n");
}
camera_old = intf;
});
if(!ret.isOk())
fprintf(stderr, "Failed getting camera 0\n");
auto cameraResult = vendor::samsung::hardware::camera::device::V5_0::ISehCameraDevice::castFrom(camera_old);
android::sp<vendor::samsung::hardware::camera::device::V5_0::ISehCameraDevice> camera = cameraResult;
if(camera == nullptr) {
fprintf(stderr, "Coulnd't get sammy device\n");
}
if(camera != nullptr) {
fprintf(stderr, "Got sammy camera device\n");
if(strcmp(argv[1], "on") == 0) {
fprintf(stderr, "Truning torch mode on power %d\n", atoi(argv[2]));
camera->sehSetTorchModeStrength(android::hardware::camera::common::V1_0::TorchMode::ON, atoi(argv[2]));
} else {
camera->sehSetTorchModeStrength(android::hardware::camera::common::V1_0::TorchMode::OFF, 0);
}
}
}