mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-29 18:59:14 +08:00
motion range
This commit is contained in:
parent
9092aaa3ac
commit
00a54c4a9b
@ -30,7 +30,7 @@ static bool containsNonZeroByte(const uint8_t* array, uint32_t startIndex, uint3
|
||||
#define SIZEOF_BITS(bits) (((bits) + 7) / 8)
|
||||
|
||||
static int getMotionRanges(InputDeviceInfo&info,INPUTDEVICEINFO&dev){
|
||||
for(int i=0;i<sizeof(dev.axis)/sizeof(INPUTAXISINFO);i++){
|
||||
for(int i=0;(i<ABS_CNT) && (i<sizeof(dev.axis)/sizeof(INPUTAXISINFO));i++){
|
||||
INPUTAXISINFO*axis=dev.axis+i;
|
||||
if(std::abs(axis->maximum-axis->minimum)>0){
|
||||
info.addMotionRange(axis->axis,0/*source*/,axis->minimum,axis->maximum,axis->flat,axis->fuzz,axis->resolution);
|
||||
|
@ -48,7 +48,7 @@ typedef struct{
|
||||
BYTE ledBitMask[4];
|
||||
BYTE ffBitMask [16];
|
||||
BYTE propBitMask[4];
|
||||
INPUTAXISINFO axis[32];
|
||||
INPUTAXISINFO axis[64/*ABS_CNT*/];
|
||||
char name[MAX_DEVICE_NAME];
|
||||
}INPUTDEVICEINFO;
|
||||
|
||||
|
@ -84,16 +84,17 @@ INT InputGetDeviceInfo(int device,INPUTDEVICEINFO*devinfo){
|
||||
struct input_id id;
|
||||
rc1=ioctl(device, EVIOCGNAME(sizeof(devinfo->name) - 1),devinfo->name);
|
||||
rc2=ioctl(device, EVIOCGID, &id);
|
||||
for(int i=0;i<ABS_CNT;i++){
|
||||
for(int i=0,j=0;i<ABS_CNT;i++){
|
||||
struct input_absinfo info;
|
||||
INPUTAXISINFO*a = devinfo->axis+i;
|
||||
if(0==ioctl(device, EVIOCGABS(i),&info)){
|
||||
if((0==ioctl(device, EVIOCGABS(i),&info))&&(info.minimum!=info.maximum)){
|
||||
INPUTAXISINFO*a = devinfo->axis+j++;
|
||||
a->axis = i;
|
||||
a->fuzz =info.fuzz;
|
||||
a->flat =info.flat;
|
||||
a->minimum=info.minimum;
|
||||
a->maximum=info.maximum;
|
||||
a->resolution=info.resolution;
|
||||
LOGD_IF(a->maximum-a->minimum,"axis[%d]=[%d,%d]",i, a->minimum,a->maximum);
|
||||
LOGI_IF(a->maximum-a->minimum,"axis[%d]=[%d,%d]",a->axis, a->minimum,a->maximum);
|
||||
}
|
||||
}
|
||||
LOGD_IF(rc2,"fd=%d[%s] rc1=%d,rc2=%d x=[%d,%d] y=[%d,%d]",device,devinfo->name,rc1,rc2);
|
||||
|
@ -84,16 +84,17 @@ INT InputGetDeviceInfo(int device,INPUTDEVICEINFO*devinfo){
|
||||
struct input_id id;
|
||||
rc1=ioctl(device, EVIOCGNAME(sizeof(devinfo->name) - 1),devinfo->name);
|
||||
rc2=ioctl(device, EVIOCGID, &id);
|
||||
for(int i=0;i<ABS_CNT;i++){
|
||||
for(int i=0,j=0;i<ABS_CNT;i++){
|
||||
struct input_absinfo info;
|
||||
INPUTAXISINFO*a = devinfo->axis+i;
|
||||
if(0==ioctl(device, EVIOCGABS(i),&info)){
|
||||
if((0==ioctl(device, EVIOCGABS(i),&info)) && (info.minimum!=info.maximum)){
|
||||
INPUTAXISINFO*a = devinfo->axis+j++;
|
||||
a->axis =i;
|
||||
a->fuzz =info.fuzz;
|
||||
a->flat =info.flat;
|
||||
a->minimum=info.minimum;
|
||||
a->maximum=info.maximum;
|
||||
a->resolution=info.resolution;
|
||||
LOGD_IF(a->maximum-a->minimum,"axis[%d]=[%d,%d]",i, a->minimum,a->maximum);
|
||||
LOGD_IF(a->maximum-a->minimum,"axis[%d]=[%d,%d]",a->axis, a->minimum,a->maximum);
|
||||
}
|
||||
}
|
||||
LOGD_IF(rc2,"fd=%d[%s] rc1=%d,rc2=%d",device,devinfo->name,rc1,rc2);
|
||||
|
@ -56,11 +56,11 @@ TEST_F(INPUT,AxisInfo){
|
||||
INPUTDEVICEINFO info;
|
||||
if(0<InputGetEvents(keys,16,500)){
|
||||
InputGetDeviceInfo(keys[0].device,&info);
|
||||
for(int j=0;j<ABS_CNT;j++){
|
||||
for(int j=0;(j<ABS_CNT)&&(j<sizeof(info.axis)/sizeof(INPUTAXISINFO));j++){
|
||||
INPUTAXISINFO*a=info.axis+j;
|
||||
if(std::abs(a->maximum-a->minimum)>0){
|
||||
axises++;
|
||||
printf("axis[%d] range=[%d,%d]\r\n",j,a->minimum,a->maximum);
|
||||
printf("axis[%d] range=[%d,%d]\r\n",a->axis,a->minimum,a->maximum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user