Hi.
I've found a bug in ffcfstress when reading the device position. In function update_device there's this code:
/* Get events */while(read(device_handle,&event,sizeof(event))==sizeof(event)) {
if(event.type==EV_ABS&&event.code==axis_code) {
*position=((double)(((short)event.value)-axis_min))*2.0/(axis_max-axis_min)-1.0;if(*position>1.0)*position=1.0;elseif(*position<-1.0)*position=-1.0;
}
}
The event.value is cast to a signed short integer. The Logitech Driving Force G29 (and maybe others) returns a value between 0 and 65535 causing this cast to fail. It should be cast to an unsigned short.
The following code works fine:
/* Get events */while(read(device_handle,&event,sizeof(event))==sizeof(event)) {
if(event.type==EV_ABS&&event.code==axis_code) {
*position=((double)(((unsignedshort)event.value)-axis_min))*2.0/(axis_max-axis_min)-1.0;if(*position>1.0)*position=1.0;elseif(*position<-1.0)*position=-1.0;
}
}
I couldn't create a proper ticket. I hope someone can apply the fix.
Thanks.
Regards.
Last edit: Bernat 2019-11-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi.
I've found a bug in ffcfstress when reading the device position. In function
update_device
there's this code:The
event.value
is cast to a signed short integer. The Logitech Driving Force G29 (and maybe others) returns a value between 0 and 65535 causing this cast to fail. It should be cast to an unsigned short.The following code works fine:
I couldn't create a proper ticket. I hope someone can apply the fix.
Thanks.
Regards.
Last edit: Bernat 2019-11-07