Add asus-motor, to be called from cameraserver to control ZF6 cam
This commit is contained in:
parent
a1527b0b28
commit
82d65bd4c3
2
base.mk
2
base.mk
@ -143,3 +143,5 @@ PRODUCT_COPY_FILES += \
|
|||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
device/phh/treble/ld.config.26.txt:system/etc/ld.config.26.txt \
|
device/phh/treble/ld.config.26.txt:system/etc/ld.config.26.txt \
|
||||||
|
|
||||||
|
PRODUCT_PACKAGES += \
|
||||||
|
asus-motor
|
||||||
|
@ -151,3 +151,10 @@ cc_binary {
|
|||||||
"libhidlbase",
|
"libhidlbase",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_binary {
|
||||||
|
name: "asus-motor",
|
||||||
|
srcs: [
|
||||||
|
"asus-motor.cpp",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
30
cmds/asus-motor.cpp
Normal file
30
cmds/asus-motor.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int dir;
|
||||||
|
int angle;
|
||||||
|
int speed;
|
||||||
|
} motorDrvManualConfig_t;
|
||||||
|
|
||||||
|
#define ASUS_MOTOR_NAME_SIZE 32
|
||||||
|
#define ASUS_MOTOR_DATA_SIZE 4
|
||||||
|
|
||||||
|
#define ASUS_MOTOR_DRV_DEV_PATH ("/dev/asusMotoDrv")
|
||||||
|
#define ASUS_MOTOR_DRV_IOC_MAGIC ('M')
|
||||||
|
#define ASUS_MOTOR_DRV_AUTO_MODE _IOW(ASUS_MOTOR_DRV_IOC_MAGIC, 1, int)
|
||||||
|
#define ASUS_MOTOR_DRV_MANUAL_MODE _IOW(ASUS_MOTOR_DRV_IOC_MAGIC, 2, motorDrvManualConfig_t)
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if(argc != 2) return 1;
|
||||||
|
int fd = open("/dev/asusMotoDrv", O_RDWR);
|
||||||
|
motorDrvManualConfig_t cfg;
|
||||||
|
cfg.dir = atoi(argv[1]);
|
||||||
|
cfg.angle = 180;
|
||||||
|
cfg.speed = 4;
|
||||||
|
|
||||||
|
ioctl(fd, ASUS_MOTOR_DRV_MANUAL_MODE, &cfg);
|
||||||
|
}
|
5
sepolicy/asus.te
Normal file
5
sepolicy/asus.te
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
allow cameraserver phhsu_exec:file rx_file_perms;
|
||||||
|
|
||||||
|
type asus_motor_device, file_type;
|
||||||
|
allow cameraserver asus_motor_device:chr_file { open read write ioctl };
|
||||||
|
allowxperm cameraserver asus_motor_device:chr_file ioctl { 0x4d02 };
|
@ -3,6 +3,7 @@
|
|||||||
/system/etc/usb_audio_policy_configuration.xml u:object_r:vendor_configs_file:s0
|
/system/etc/usb_audio_policy_configuration.xml u:object_r:vendor_configs_file:s0
|
||||||
/system/bin/rw-system.sh u:object_r:phhsu_exec:s0
|
/system/bin/rw-system.sh u:object_r:phhsu_exec:s0
|
||||||
/system/bin/phh-on-boot.sh u:object_r:phhsu_exec:s0
|
/system/bin/phh-on-boot.sh u:object_r:phhsu_exec:s0
|
||||||
|
/system/bin/asus-motor u:object_r:phhsu_exec:s0
|
||||||
|
|
||||||
#/system/bin/fsck\.exfat u:object_r:fsck_exec:s0
|
#/system/bin/fsck\.exfat u:object_r:fsck_exec:s0
|
||||||
/system/bin/fsck\.ntfs u:object_r:fsck_exec:s0
|
/system/bin/fsck\.ntfs u:object_r:fsck_exec:s0
|
||||||
|
Loading…
Reference in New Issue
Block a user