[PD] HID seg fault on linux - debugging

Hans-Christoph Steiner hans at eds.org
Sun Jun 5 15:54:49 CEST 2005


Wow, thanks for debugging this, I'll definitely fix it now.  This  
illustrates a common problem with HID devices: lots of non-standard HID  
implementations.  There can be a total of this many axes:

#define ABS_MAX			0x3f

But the input_arrays.c array only goes to 0x28 since that is the last  
one that is named in the linux system.  It looks like your device is  
using non-standard axes names/numbers.  This used to happen to me when  
I used my Force Feedback joystick with linux and the force feedback was  
not detected, so I might be the linux system misrecognizing your device  
as well.

.hc

On Jun 4, 2005, at 10:10 PM, august wrote:

>
>
>
> 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.
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->  
> http://lists.puredata.info/listinfo/pd-list
>

________________________________________________________________________ 
____

"[W]e have invented the technology to eliminate scarcity, but we are  
deliberately throwing it
away to benefit those who profit from scarcity."
							-John Gilmore





More information about the Pd-list mailing list