[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] = {

....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