On 06/19/12 14:09, Ludovic Rousseau wrote:
> 2012/6/19 Frank Marien <[email protected]>:
>> 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)?
> A PC/SC application should not use MAX_READERNAME.
> It was a mistake to have this define in (user visible) pcsclite.h header file.
I fear it will be used.. but that should be easy to audit for, for all
FOSS at least :-)

>>>> 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 :-)
> Maybe the simplest solution is to edit the file
> ccid/readers/supported_readers.txt and change the line:
> 0x04E6:0x5119:SCM Microsystems Inc. SCR3340 - ExpressCard54 Smart Card Reader
> to something shorter like
> 0x04E6:0x5119:SCM SCR3340 - ExpressCard54
>
> You can also directly edit
> /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist if you do
> not want to reinstall the CCID driver.
>
> No need to recompile pcsc-lite in this case.
Confirmed for my case.. Thanks. This is far less work to add to puppet
profiles than a custom-built
pcsc-lite by far: I post-process

/usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist

..and simply alter that one particular string. Thanks!
>
> The reader names are now (since version 1.4.6 of the driver) generated
> from the iManufacturer and iProduct strings from the USB descriptor.
> And I forgot about the string size limitation to 100 characters.
Yeah it has a very "legacy" feel to it, that #define :-)

>
> Bye
>
Thanks!

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to