O2 Micro OZ776 not working with libccid 1.4.15-1

Bug #1311273 reported by Matt on 2014-04-22
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
ccid (Ubuntu)
Undecided
Unassigned

Bug Description

Description: Ubuntu 14.04 LTS
Release: 14.04

1.4.15-1 - not working (gpg(2) --card-status, gpg(2) --card-edit, ..)

1.4.12-1 - working (gpg(2) --card-status, gpg(2) --card-edit, ..)

Matt (mathem) wrote :

The way I can reproduce the bug:

- fresh 14.04 install / live boot
- installed gnupg2 pcscd pcsc-tools scdaemon

Now my gnupg smartcard v2 isn't recognized by gpg(2), but with pcsc_scan I get the normal output

How it works again:

- manual install of libccid 1.4.12-1, then apt-get install pcscd pcsc-tools

If you can get the ATR using pcsc_scan then the CCID driver is working correctly.

Maybe you can get some debug from gnupg2 to know what is wrong.

Tim Banchi (tim-banchi) wrote :

I can confirm the problem with libccid 1.4.15-1 with my Oz776 Smartcard reader in ubuntu 14.04. While I can still see the card information correctly with pcsc_scan and libccid 1.4.15, other applications using the cardreader stopped working as soon as I upgraded from 13.10 (libccid1.4.12) to 14.04 (libccid 1.4.15).

In a java application I got the following log:
[PCSCEidController] Clearing Data for security reasons, due to unexpected problem.
sun.security.smartcardio.PCSCException: SCARD_E_NOT_TRANSACTED
sun.security.smartcardio.ChannelImpl.doTransmit(ChannelImpl.java:219)
sun.security.smartcardio.ChannelImpl.transmit(ChannelImpl.java:90)
be.fedict.eid.applet.sc.PcscEid.transmit(PcscEid.java:1531)
be.fedict.eid.applet.sc.PcscEid.selectFile(PcscEid.java:550)
be.fedict.eid.applet.sc.PcscEid.readFile(PcscEid.java:255)
be.fedict.eidviewer.lib.PCSCEid.readFile(PCSCEid.java:82)
be.fedict.eidviewer.lib.PCSCEid.getFile(PCSCEid.java:336)
be.fedict.eidviewer.lib.PCSCEid.getIdentity(PCSCEid.java:95)
be.fedict.eidviewer.lib.PCSCEidController.run(PCSCEidController.java:378
)
java.lang.Thread.run(Thread.java:744)

and probably more relevant:
[PCSCEidController] Clearing Data for security reasons, due to unexpected problem.
apdu must be at least 2 bytes long
javax.smartcardio.ResponseAPDU.check(ResponseAPDU.java:73)
javax.smartcardio.ResponseAPDU.<init>(ResponseAPDU.java:67)
sun.security.smartcardio.ChannelImpl.transmit(ChannelImpl.java:91)
be.fedict.eid.applet.sc.PcscEid.transmit(PcscEid.java:1531)
be.fedict.eid.applet.sc.PcscEid.selectFile(PcscEid.java:550)
be.fedict.eid.applet.sc.PcscEid.readFile(PcscEid.java:255)
be.fedict.eidviewer.lib.PCSCEid.readFile(PCSCEid.java:82)
be.fedict.eidviewer.lib.PCSCEid.getFile(PCSCEid.java:336)
be.fedict.eidviewer.lib.PCSCEid.getIdentity(PCSCEid.java:95)
be.fedict.eidviewer.lib.PCSCEidController.run(PCSCEidController.java:378

The problems can be resolved by:
- manually switching back to libccid 1.4.12
sudo dpkg -i libccid_1.4.12-1_i386.deb

- reinstalling pcscd, pcsc-tools and the applications needing the smartcard reader (in my case eid-mw and eid-viewer from the belgium government for online tax declaration)
sudo apt-get purge pcscd pcsc-tools eid-mw eid-viewer
sudo apt-get install pcscd pcsc-tools
sudo dpkg -i eid-mw_4.0.4r1253_i386_tcm227-178474.deb
sudo dpkg -i eid-viewer_4.0.4r146_i386_tcm227-178471.deb

- restarting pcscd service:
sudo service pcscd restart

afterwards all the applications I use needing the smartcard reader (belgium online tax declaration, austrian A-trust bürgerkarte) work again as expected.

The problem with the Oz776 Smartcard reader has been fixed in CCID version 1.4.17 (see http://ludovicrousseau.blogspot.fr/2014/06/new-version-of-libccid-1417.html)

Mat, do you also have a Oz776 Smartcard reader?
If not please follow http://pcsclite.alioth.debian.org/ccid.html#support

Matt (mathem) wrote :

I also have a Oz776 Smartcard reader and it seems to work now with 1.4.17! Thanks for your effort!

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ccid (Ubuntu):
status: New → Confirmed
Spott (spott-spottraining) wrote :

I have the same problem. Is it possible to update Ubuntu libccid package to 1.4.17 version?
Card reader work before upgrade - but not any more.
Or can maybe someone give hint - how I can replace Ubuntu original libccid package with new one?

Matt (mathem) wrote :

You can download the utopic 64-bit (amd64) or 32-bit (i386) version of libccid here:

http://packages.ubuntu.com/utopic/libccid

Install it with: sudo dpkg -i 'packagename'.deb

Tim Banchi (tim-banchi) wrote :

Hello,

unfortunately the bug is still present in 1.4.17 and also 1.4.19. I get exactly the aforentioned error message with both the newer libccid packages:

SEVERE: Clearing Data for security reasons, due to unexpected problem.
sun.security.smartcardio.PCSCException: SCARD_E_NOT_TRANSACTED
...

to get it back working:
sudo apt-get purge libccid
sudo apt-get autoremove
sudo dpkg -i libccid_1.4.12-1_i386.deb
sudo apt-get install eid-mw eid-viewer eid-archive pcscd pcsc-tools

Using Linux Mint 17.1 (I think based on Ubuntu 14.04) 32bit.
It is the built-in reader in the Dell D430 notebook (Bus 001 Device 005: ID 0b97:7761 O2 Micro, Inc. Oz776 1.1 Hub). With 1.4.12 I can use the Belgian tax-on-web (eid) as well as the Austrian bürgerkarte application (Mocca).

Tim, I need traces from the CCID driver to know what exactly is wrong.
Please follow http://pcsclite.alioth.debian.org/ccid.html#support

  • eid-viewer.log Edit (15.4 KiB, text/x-log; charset=US-ASCII; name="eid-viewer.log")
  • pcscd.log Edit (58.5 KiB, text/x-log; charset=US-ASCII; name="pcscd.log")
  • pcsc_scan.log Edit (2.7 KiB, text/x-log; charset=US-ASCII; name="pcsc_scan.log")
Download full text (4.9 KiB)

On Wed, May 27, 2015 at 11:15 AM, Ludovic Rousseau <
<email address hidden>> wrote:

> Tim, I need traces from the CCID driver to know what exactly is wrong.
> Please follow http://pcsclite.alioth.debian.org/ccid.html#support
>
> Hello Rousseau,

I followed your instructions concerning support. I enclose 3 logs:
1) the log from pcscd (sudo LIBCCID_ifdLogLevel=0x000F pcscd --foreground
--debug --apdu | tee pcscd.log)
2) the log from eid-viewer (which fails to read data from the smartcard)
3) the log from pcsc_scan (both of the cards not working)

Further information:

=== Versions ===
libccid version: 1.4.19-1
libpcsclite1:i386 version: 1.8.10-1ubuntu1
smartcard middleware: 1.8.10-1ubuntu1

--> sudo dpkg -l | grep pcsc
libpcsc-perl 1.4.13-1build1
libpcsclite-dev 1.8.10-1ubuntu1
pcsc-tools 1.4.22-1
pcscd 1.8.10-1ubuntu1

=== pcscd output ===
/usr/sbin/pcscd --version
pcsc-lite version 1.8.10.
Copyright (C) 1999-2002 by David Corcoran <email address hidden>.
Copyright (C) 2001-2011 by Ludovic Rousseau <email address hidden>.
Copyright (C) 2003-2004 by Damien Sauveron <email address hidden>.
Report bugs to <email address hidden>.
Enabled features: Linux i686-pc-linux-gnu serial usb libudev
usbdropdir=/usr/lib/pcsc/drivers ipcdir=/var/run/pcscd
configdir=/etc/reader.conf.d

=== Operating System information ===
--> lsb_release -a
No LSB modules are available.
Distributor ID: LinuxMint
Description: Linux Mint 17.1 Rebecca
Release: 17.1
Codename: rebecca

--> uname -a
Linux gavroche 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:31:42 UTC 2014
i686 i686 i686 GNU/Linux

=== Smartcard reader information ===
O2 Micro, Inc. Oz776 SmartCard Reader
manufacturer: O2 Micro
model: Oz776
--> lsusb -v:
Bus 001 Device 010: ID 0b97:7762 O2 Micro, Inc. Oz776 SmartCard Reader
Device Descriptor:
  bLength 18
  bDescriptorType 1
  bcdUSB 1.10
  bDeviceClass 0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize0 64
  idVendor 0x0b97 O2 Micro, Inc.
  idProduct 0x7762 Oz776 SmartCard Reader
  bcdDevice 1.10
  iManufacturer 1 O2
  iProduct 2 O2Micro CCID SC Reader
  iSerial 0
  bNumConfigurations 1
  Configuration Descriptor:
    bLength 9
    bDescriptorType 2
    wTotalLength 93
    bNumInterfaces 1
    bConfigurationValue 1
    iConfiguration 0
    bmAttributes 0xe0
      Self Powered
      Remote Wakeup
    MaxPower 0mA
    Interface Descriptor:
      bLength 9
      bDescriptorType 4
      bInterfaceNumber 0
      bAlternateSetting 0
      bNumEndpoints 3
      bInterfaceClass 11 Chip/SmartCard
      bInterfaceSubClass 0
      bInterfaceProtocol 0
      iInterface 0
      Endpoint Descriptor:
        bLength 7
        bDescriptorType 5
        bEndpointAddress 0x03 EP 3 OUT
        bmAttributes 2
          Transfer Type Bulk
          Synch Type N...

Read more...

Tim, thanks for the traces.

Can you generate the same traces using libccid 1.4.12-1 or whatever version was working?
I need to understand how it was working with an old driver.

Tim Banchi (tim-banchi) wrote :

Hello Ludvoic,

here is the pcscd log with libccid 1.4.12-1.

Tim Banchi (tim-banchi) wrote :

and here is the log of eid-viewer. I tried out my card and the card of a colleague and it worked out right away with 1.4.12

Thank you for following up the problem.
Tim

I guess the problem is because of the patch in https://anonscm.debian.org/cgit/pcsclite/CCID.git/commit/?id=81c82c8852010f362bb48968b4f5df27a4789a48

To be sure just revert the above patch in the driver and try with the patched driver.

This change has been introduced in version 1.4.15 of the CCID driver. Drivers up to 1.4.14 should work with your reader.

Matt and/or Tim, can you test a new version of the driver for me?

Tim Banchi (tim-banchi) wrote :

Dear Rousseau,

sorry for not coming back to you. I was busy with study and I planned testing the new version next weekend!

TIm, can you try with ccid-OZ776-1.4.19.tar.bz2 available at http://ludovic.rousseau.free.fr/softwares/pcsc-lite/

Then generate a new pcscd trace.

Tim Banchi (tim-banchi) wrote :

Hello Rousseau,

it seems to work!
1) sudo apt-get install libusb-dev libusb-1.0-0-dev
2) ./configure
3) make
4) sudo make install
5) sudo cp src/92_pcscd_ccid.rules /etc/udev/rules.d/
6) killall pcscd
7) sudo LIBCCID_ifdLogLevel=0x000F pcscd --foreground --debug --apdu | tee log2.txt
--> pcscdlog is enclosed

I could afterwards get the information from the eID card (eid-viewer) and successfully log on with my austrian bürgerkarte to my bank account.

I still had libccid 1.4.15 installed but the pcscd log shows that 1.4.19 is used. Also
sudo lsof -P -T -p <pid of pcscd/> | grep libccid
--> pcscd 24434 root mem REG 8,5 295478 390549 /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so

Tim

Great. Thank you Tim.

I modified the fix.
Can you try again with the new version available at http://ludovic.rousseau.free.fr/softwares/pcsc-lite/

Tim Banchi (tim-banchi) wrote :

Hi Rousseau,

I downloaded http://ludovic.rousseau.free.fr/softwares/pcsc-lite/ccid-1.4.19.tar.bz2 and my smartcard reader is still working ( I tried eid-viewer + bürgerkarte login as before). I enclose the pcscd log.

Thank you again,
Tim

Fixed in https://anonscm.debian.org/cgit/pcsclite/CCID.git/commit/?id=205e4657b87aa9367af755f28461436ab43696d5

The next version of the CCID driver (1.4.20) will contain the patch.
Thanks for your time.

Changed in ccid (Ubuntu):
status: Confirmed → Fix Committed

Just to acknowledge that I had the same issue and it indeed seems to be fixed in 1.4.20
 (on Mint)
Grtz

Changed in ccid (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers