Bug 249808 - pcscd does not open /dev/ttyS1 after kernel update
pcscd does not open /dev/ttyS1 after kernel update
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: pcsc-lite (Show other bugs)
7
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bob Relyea
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-27 04:13 EDT by Giuseppe Paterno
Modified: 2009-02-16 17:32 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-06-16 21:59:07 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
PCSCD debug (1.19 KB, text/plain)
2007-07-27 04:13 EDT, Giuseppe Paterno
no flags Details
PCSCD strace output (in gzip) (2.58 MB, application/octet-stream)
2007-07-27 04:23 EDT, Giuseppe Paterno
no flags Details

  None (edit)
Description Giuseppe Paterno 2007-07-27 04:13:37 EDT
Hi!
Environment: Laptop with GemPC PCMCIA card
Fedora 7, kernel 2.6.22.1-27.fc7
pcsc-lite ver 1.3.3-1.fc7
ccid 1.2.1-1.fc7 

After kernel update, the gempc card has been now named ttyS1. By reflecting the
change into reader as:

FRIENDLYNAME      "GemPCTwin serial"
DEVICENAME        /dev/ttyS1
LIBPATH           /usr/lib/pcsc/drivers/serial/libccidtwin.so.1.2.1
CHANNELID         1

(previously was ttyS2 with channelid 2)

now pcscd says:
readerfactory.c:1143:RFInitializeReader() Open Port 1 Failed (/dev/ttyS1)
readerfactory.c:1022:RFUnloadReader() Unloading reader driver.
readerfactory.c:251:RFAddReader() GemPCTwin serial init failed.

Altough the syscall open("/dev/ttyS1", O_RDWR|O_NOCTTY) returns the actual fd.
In attach the debug output (pcscd-debug.txt) and the strace pcscd-trace.txt).
Dmesg shows that ttyS1 is the actual gempc card seen as serial:
0.0: ttyS1 at I/O 0x3e8 (irq = 3) is a 16450

Any hint would be appreciated.
Comment 1 Giuseppe Paterno 2007-07-27 04:13:38 EDT
Created attachment 160101 [details]
PCSCD debug
Comment 2 Giuseppe Paterno 2007-07-27 04:23:49 EDT
Created attachment 160103 [details]
PCSCD strace output (in gzip)
Comment 3 Giuseppe Paterno 2007-07-27 04:30:03 EDT
Quick add. An external USB reader (Axalto Reflex USB v3) is working fine.
Just need to understand why is not opening anymore the gempc pcmcia card.
Comment 4 Ludovic Rousseau 2007-07-31 12:38:07 EDT
That is strange.

From the strace output:
6097  open("/dev/ttyS1", O_RDWR|O_NOCTTY) = 4
6097  ioctl(4, TIOCMGET, [TIOCM_DTR|TIOCM_RTS|TIOCM_DSR|0x4000]) = 0
6097  ioctl(4, TIOCMSET, [TIOCM_DTR|TIOCM_DSR|0x4000]) = 0
6097  ioctl(4, TCFLSH, 0x2)             = 0
6097  ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon
-echo ...}) = 0
6097  write(2, "\33[34mccid_serial.c:727:OpenSeria"..., 107) = 107
6097  ioctl(4, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo
...}) = 0
6097  ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 -opost -isig -icanon
-echo ...}) = 0
6097  write(4, "\3\6k\1\0\0\0\0\0\0\0\0\2m", 14) = 14
6097  select(5, [4], NULL, NULL, {2, 0}) = 0 (Timeout)
6097  write(2, "\33[01;31mccid_serial.c:750:OpenSe"..., 104) = 104
6097  close(4)                          = 0
6097  write(2, "\33[01;31mifdhandler.c:95:IFDHCrea"..., 61) = 61
6097  write(2, "\33[01;31mreaderfactory.c:1143:RFI"..., 86) = 86
6097  write(2, "\33[34mreaderfactory.c:1022:RFUnlo"..., 72) = 72

The reader failed to respond to the command (timeout).

Maybe a bug in the kernel pcmcia-serial bridge or something like that?
Comment 5 Giuseppe Paterno 2007-08-01 04:09:26 EDT
IMHO this is something that makes sense. Open() is working and device is workng
under Windows (same laptop, same devices).... kernel is the only thing has
really change (and these kernels are quite buggy).
Comment 6 Giuseppe Paterno 2007-08-06 04:18:09 EDT
this is a kernel issue and might broke other stuffs.
Comment 7 Giuseppe Paterno 2007-08-27 05:21:34 EDT
solved in kernel 2.6.22.4-65.fc7 today.
Device is now seen back as /dev/ttyS2.
Comment 8 David Mueller 2007-08-28 12:01:22 EDT
kernel 2.6.22.4-65.fc7 does not fix this problem for me.  On a ThinkPad T43
running this kernel I get the following error (the device appears as ttyS1 when
in /var/log/messages on this computer):

# /usr/sbin/pcscd -f
pcscdaemon.c:319:main() pcscd set to foreground with debug send to 
stderr
readerfactory.c:1108:RFInitializeReader() Attempting startup of Lenovo 
GemPC Card 00 00 using /usr/lib/pcsc/drivers/serial/libccidtwin.so.1.2.1
readerfactory.c:977:RFBindFunctions() Loading IFD Handler 3.0
ifdhandler.c:1231:init_driver() LogLevel: 0x0003
ifdhandler.c:1241:init_driver() DriverOptions: 0x0004
ifdhandler.c:77:IFDHCreateChannelByName() lun: 0, device: /dev/ttyS1
ccid_serial.c:727:OpenSerialByName() Set serial port baudrate to 115200 
and correct configuration
ccid_serial.c:750:OpenSerialByName() Get firmware failed. Maybe the 
reader is not connected
Comment 9 Ludovic Rousseau 2007-08-28 15:22:28 EDT
I guess the reader was _connected_ when you started pcscd -f, right?

I would need you to set the driver in debug mode. Edit the file
/usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist and change ifdLogLevel
from 0x0003 to 0x0007

Also run pcscd as "/usr/sbin/pcscd --foreground --debug"
Comment 10 David Mueller 2007-08-28 16:07:08 EDT
First I ran tail -f /var/log/messages and inserted the card (I've removed the
hostname):

Aug 28 13:02:18 (hostname) kernel: pccard: PCMCIA card inserted into slot 0
Aug 28 13:02:18 (hostname) kernel: pcmcia: registering new device pcmcia0.0
Aug 28 13:02:18 (hostname) kernel: 0.0: ttyS1 at I/O 0x2f8 (irq = 3) is a 16450

Then I ran pcscd:
# /usr/sbin/pcscd --foreground --debug
pcscdaemon.c:319:main() pcscd set to foreground with debug send to stderr
debuglog.c:211:DebugLogSetLevel() debug level=debug
readerfactory.c:1108:RFInitializeReader() Attempting startup of Lenovo GemPC
Card 00 00 using /usr/lib/pcsc/drivers/serial/libccidtwin.so.1.2.1
readerfactory.c:977:RFBindFunctions() Loading IFD Handler 3.0
ifdhandler.c:1231:init_driver() LogLevel: 0x0007
ifdhandler.c:1241:init_driver() DriverOptions: 0x0004
ifdhandler.c:77:IFDHCreateChannelByName() lun: 0, device: /dev/ttyS1
ccid_serial.c:640:OpenSerialByName() Reader index: 0, Device: /dev/ttyS1
ccid_serial.c:688:OpenSerialByName() Plug-n-Play inhibition successful
ccid_serial.c:727:OpenSerialByName() Set serial port baudrate to 115200 and
correct configuration
-> 000000 03 06 6B 01 00 00 00 00 00 00 00 00 02 6D 
ccid_serial.c:234:ReadSerial() start
ccid_serial.c:351:get_bytes() available: 0, needed: 1
ccid_serial.c:374:get_bytes() get more data: 1
ccid_serial.c:431:ReadChunk() Timeout! (2 sec)
ccid_serial.c:750:OpenSerialByName() Get firmware failed. Maybe the reader is
not connected
ccid_serial.c:796:CloseSerial() Closing serial device: /dev/ttyS1
ccid_serial.c:804:CloseSerial() Last slot closed. Release resources
ifdhandler.c:95:IFDHCreateChannelByName() failed
readerfactory.c:1143:RFInitializeReader() Open Port 3 Failed (/dev/ttyS1)
readerfactory.c:1022:RFUnloadReader() Unloading reader driver.
readerfactory.c:251:RFAddReader() Lenovo GemPC Card init failed.
pcscdaemon.c:533:main() pcsc-lite 1.3.3 daemon ready.

And for reference, here is my reader configuration file:

# cat /etc/reader.conf.d/gempc.conf 
FRIENDLYNAME "Lenovo GemPC Card"
DEVICENAME /dev/ttyS1
LIBPATH /usr/lib/pcsc/drivers/serial/libccidtwin.so.1.2.1
CHANNELID 3
Comment 11 Ludovic Rousseau 2007-08-28 17:16:40 EDT
Did the reader worked on this machine? with a previous kernel?
Comment 12 David Mueller 2007-08-28 18:55:41 EDT
I have yet to get the reader to work on this particular machine.  It is a new
Fedora install a couple weeks ago; previously it only had Windows.  The previous
kernel was 2.6.22.1-41.fc7 and that didn't work either.

But the story gets stranger.  I also have tried it with a ThinkPad X60.  The
reader works perfectly with either kernel version, but only if the laptop is not
in its docking station (the T43 doesn't have one).  If the X60 is docked, the
third line from /var/log/messages that shows the ttyS device and IRQ doesn't
appear, and I don't see the reader listed in applications like Firefox.  But
that is, I think, another issue for another day.
Comment 13 Ludovic Rousseau 2007-08-29 07:56:45 EDT
The docking station problem is already known (by me). I have no idea how to
correct it (if even possible)

You will never see the reader in Firefox. You need to install a PKCS#11 token
for that. And that is a completely different story. Have a look at OpenSC or
coolkey.
Comment 14 David Mueller 2007-08-29 11:10:59 EDT
I already have Coolkey installed and have the systems working with USB readers
(ActivCard USB 2.0 and SCR-331).
Comment 15 Bug Zapper 2008-05-14 09:42:09 EDT
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '7'.

Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 7's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 7 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:
http://docs.fedoraproject.org/release-notes/

The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 16 Bug Zapper 2008-06-16 21:59:05 EDT
Fedora 7 changed to end-of-life (EOL) status on June 13, 2008. 
Fedora 7 is no longer maintained, which means that it will not 
receive any further security or bug fix updates. As a result we 
are closing this bug. 

If you can reproduce this bug against a currently maintained version 
of Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 17 Lionel Elie Mamane 2009-02-16 17:32:03 EST
I got the same issue and here is how I solved it:

It was caused by setserial having saved (and restoring at boot time) the configuration of /dev/ttyS0 when the laptop computer was in its docking station, namely a 16650A, while the reader has a 16450 (or an emulation thereof). Telling setserial not to touch the configuration solved the problem, after a reboot.

Note You need to log in before you can comment on or make changes to this bug.