2012/8/23 Pete Batard <p...@akeo.ie>: > On 2012.08.23 12:57, sebastiank wrote: >> Pcscd does not function as expected, i.e. my app is not able to find >> the attached rfid-reader, although pcscd is recognising it and is >> logging the card insertion and removal. >> >> This is happening, when pcscd is started as daemon and >> >> - LIBUSB_DEBUG = 4 && libusbx was compiled without the >> "--enable-debug-log" flag, >> - LIBUSB_DEBUG < 4 && libusbx was compiled with the >> "--enable-debug-log" flag or >> - LIBUSB_DEBUG = 4 && libusbx was compiled with the >> "--enable-debug-log" flag. > > LIBUSB_DEBUG = 4 and --enable-debug-log aim at producing the same thing, > so, though the non detection is surprising, what's not surprising is > that you would get the same issue with either LIBUSB_DEBUG = 4 or > --enable-debug-log. > >> If pcscd is running in foreground mode, everything works fine, no >> matter which value (1-4) is assigned to LIBUSB_DEBUG and >> "--enabled-debug-log" flag was active or not. > > Could be a problem with output redirection in pcscd then, rather than a > libusbx issue. Considering that no other application has complained > about not being able to detect devices when playing with logging, and I > have see no evidence that using DEBUG will prevent device detection, I > don't think this is a pure libusbx issue. > But maybe Ludovic has some ideas.
The bug is in libusbx :-) and also in pcsc-lite :-( I already reported the issue in 2008 in "A library shall not write to stderr or stdout without explicit request" [1]. The problem is that libusbx is sending data to stderr (equivalent to file descriptor 2 on Unix) without knowing what is behind the file descriptor 2. pcscd when started as a daemon (in background) do close stdin, stdout and stderr. See also the daemon manpage [2] and the noclose argument. The problem in pcsc-lite is that stdin, stdout and stderr are NOT redirected to /dev/null. Even if a comment says so. So the file descriptor 2 (stderr) is used by pcsc-lite for something else and libusbx sends its log messages to this file descriptor and completely confuses pcscd. I just fixed the problem in pcscd in revision 6446. Bye [1] http://libusb.6.n5.nabble.com/A-library-shall-not-write-to-stderr-or-stdout-without-excplicit-request-td4846.html [2] -- Dr. Ludovic Rousseau ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel