hi
using hid i had problems with my joystick, crashing immediately as soon as i used the throttle.
the reason turned out to be a fixed-sized character array which was limited to 7(!) characters and strcpy'ing names without any checks. unfortunately my "abs_throttle" is a bit longer than 7 characters.
now i am wondering why all the event-name handling is done via character-arrays and not with pd symbols?
pollution of the symbol-table can not be the problem, since what is going on is something like that: 1. (hid_linux): get the name (*char) 2. (hid_linux): copy it to to event_name (char[7]) 3. (hid_linux): pass &event_name to hid::hid_output_event() 4. (hid): gensym(event_name) and output it
i don't see any good reason to not generate the t_symbol's much earlier in the process, in order to allow names of any length (and let pd handle the allocation): 1. (hid_linux); get the name (char*) and gensym() it 2. (hid_linux): pass the symbol to hid::hid_output_event() 3. (hid): output the symbol
i have committed several changes to the CVS, but since i didn't want to break the API where i cannot test (osX), i have only changed hid_linux.c; this complicates the code a bit to: 1. (hid_linux); get the name (char*) and gensym() it 2. (hid_linux): pass the char* in the symbol (s->s_name) to hid::hid_output_event() 3. (hid): gensym() it again and output this involves 2 symhashtable lookups instead of just one.
so the question is: is this by (bad) design?
any objections to change (in hid.[ch]) void hid_output_event(t_hid *x, char *type, char *code, t_float value); to void hid_output_event(t_hid *x, t_symbol*type, t_symbol*code, t_float value); ??
mfga.sdr. IOhannes
PS: i also did some other (small) changes, in order to make it possible to compile this object without having 80MB of code checked out