On 06/19/12 13:42, Ludovic Rousseau wrote: > 2012/6/19 Frank Marien <[email protected]>: >> Dear list, > Hello, > >> I'm seeing a problem similar to Marti: With card reader names that are >> already long, like the >> "SCM Microsystems, Inc. SCR3340 - ExpressCard54 Smart Card Reader" I just >> plugged into >> my new laptop, the code in hotplug_libudev.c that optionally adds interface >> and serial number to the name may cause that name to become too long as >> compared to MAX_READERNAME, and thereby make RFAddReader reject it. >> >> The obvious brute-force solution I tried was to raise MAX_READERNAME from >> 100 to 128 in /usr/include/PCSC/pcsclite.h. That worked, but that's only >> safe if one can recompile every single dependency in one's system. I tried >> it just to prove that that was all that was wrong here. >> >> I considered undefining the #ifdefs that guard the addition of interface and >> serial, but I figured there must be a good reason for them to be on in the >> first place (uniqueness, probably), so I didn't dare suggest that. > You are right. > The solution is to use a dynamically allocated string to store the > reader name, instead of a limitation to MAX_READERNAME characters. Wouldn't application-level developers have used MAX_READERNAME and allocated static buffers of that size (and.. counted on the name never being longer)?
> > I opened bug #313684 [1] to not forget it. Thanks. > > [1] > https://alioth.debian.org/tracker/index.php?func=detail&aid=313684&group_id=30105&atid=410085 Thanks! >> However, unless this newbie is gravely naive, I see no reason for the >> interface name to be called "XXXX Interface" since it's clear that is is an >> interface, it's probably not wise to try and parse that string anyway, and >> if we do.. the interface strings should be known and not resemble a serial >> number. >> >> Since I needed only 5 characters less, I decided to remove anything after a >> space in the interface name (see patch below), thus gaining 9 characters and >> falling within the standard setting in the headers.. Instead of adding >> "[CCID Interface]", now only [CCID] is added to the name. > Your reader returns "CCID Interface" for the iInterface field. Other > readers return something else without "Interface" inside. > So your modification is valid only for this particular reader (and some > others). Yes, feared it would be, after I could not find where the "Interface" string came from looking through the sources for CCID or pcscd.. So that will only work if iInterface contains multiple words.. It looked like something you added.. :-( no cigar, but hey, I can work and bug #313684 now exists. Good enough for me :-) > >> It might help to generalize this, think about how to keep the name as short >> as possible and still have uniqueness even with identical readers.. Not >> trivial, in a free-form string, but apparently necessary.. > The uniqueness should come from the numbers after the reader name. Then we might safely forego adding e.g. serial number? > > Bye > _______________________________________________ Muscle mailing list [email protected] http://lists.drizzle.com/mailman/listinfo/muscle
