[PD] HID seg fault on linux - debugging

august august at alien.mur.at
Sun Jun 5 04:10:27 CEST 2005




I think I've narrowed it down further.

I can see that it crashes when the event.typ is 3 and the event.code is
greater than 41.  41 is the default max that is generated for the ev_abs
enumeration by the  make-arrays-from-input.h.pl script.  however, it seems
like my usb device is sending abs event.codes that are greater than 41 in
the enumeration.

so, to keep it from crashing I put the follwoing code into hid_linux.c

if (hid_input_event.code < 41) {
	strcpy(hid_code, event_names[hid_input_event.type][hid_input_event.code] );
}


this keeps it from crashing, but I can only retrieve valueds from 6 of
my 10 axises of my USB device.

could it be that make-arrays-from-input.h.pl  is generating the wrong
amount of ev_abs?

in input_arrays.c I see:

int ev_abs_total = 41;  /* # of elements in array */
char *ev_abs[41] = {
"abs_x","abs_y","abs_z","abs_rx","abs_ry","abs_rz",
"abs_throttle","abs_rudder","abs_wheel","abs_gas","abs_brake",NULL,
NULL,NULL,NULL,NULL,"abs_hat0x","abs_hat0y",
"abs_hat1x","abs_hat1y","abs_hat2x","abs_hat2y","abs_hat3x","abs_hat3y",
"abs_pressure","abs_distance","abs_tilt_x","abs_tilt_y","abs_tool_width",NULL,
NULL,NULL,"abs_volume",NULL,NULL,NULL,


....and I crash at the strcpy call if hid_input_event.type = 3 (ev_abs)
AND hid_input_event.code > 41.


suggestions?  thanks in advance -august.




More information about the Pd-list mailing list