[Pcsclite-cvs-commit] r4610 - /trunk/Drivers/ccid/src/ccid.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Sun Dec 13 17:44:01 UTC 2009
Author: rousseau
Date: Sun Dec 13 17:44:01 2009
New Revision: 4610
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4610
Log:
ccid_open_hack_post(): get the language selected during Mac OS X
installation as language to use for Covadis Véga-Alpha and Gemalto GemPC
PinPad pinpad readers
Modified:
trunk/Drivers/ccid/src/ccid.c
Modified: trunk/Drivers/ccid/src/ccid.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid.c?rev=4610&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid.c (original)
+++ trunk/Drivers/ccid/src/ccid.c Sun Dec 13 17:44:01 2009
@@ -34,6 +34,10 @@
#include "ccid_ifdhandler.h"
#include "commands.h"
#include "ccid_usb.h"
+
+#ifdef __APPLE__
+#include <CoreFoundation/CoreFoundation.h>
+#endif
/*****************************************************************************
*
@@ -248,10 +252,28 @@
"Card Error",
"PIN blocked" };
- char *lang;
+ const char *lang;
const char **l10n;
+#ifdef __APPLE__
+ CFArrayRef cfa;
+ CFStringRef slang;
+
+ /* Get the complete ordered list */
+ cfa = CFLocaleCopyPreferredLanguages();
+
+ /* Use the first/preferred language
+ * As the driver is run as root we get the language
+ * selected during install */
+ slang = CFArrayGetValueAtIndex(cfa, 0);
+
+ /* CFString -> C string */
+ lang = CFStringGetCStringPtr(slang, kCFStringEncodingMacRoman);
+#else
+ /* The other Unixes just use the LANG env variable */
lang = getenv("LANG");
+#endif
+ DEBUG_COMM2("Using lang: %s", lang);
if (NULL == lang)
l10n = en;
else
@@ -274,6 +296,10 @@
l10n = en;
}
+#ifdef __APPLE__
+ /* Release the allocated array */
+ CFRelease(cfa);
+#endif
offset = 0;
cmd[offset++] = 0xB2; /* load strings */
cmd[offset++] = 0xA0; /* address of the memory */
More information about the Pcsclite-cvs-commit
mailing list