LudovicRousseau / CCID

CCID driver
https://ccid.apdu.fr/
GNU Lesser General Public License v2.1
235 stars 79 forks source link

HID OMNIKEY 5023 ; ccid_usb.c:888:WriteUSB() write failed (1/14): LIBUSB_ERROR_TIMEOUT #101

Closed Sukhoimaster closed 2 years ago

Sukhoimaster commented 2 years ago

Dear Ludovic, First of all, I would to express deepest gratitude to the whole team and you for this PCSC , CCID, & Pyscard project. The project has been very much helpful for those required such as myself 😃

Regarding the above subject, im requesting support for the issue im facing .

The application process

Originally ;

Alternative ; using [ACS ACR1281-u reader] & [HID OMNIKEY 5023] with Pyscard API for my application to read write smart card [MIFARE+ 1k ,4k & DESFIRE EV2(contain MIFARE 4k configuration & data)].

I have tried in various configuration scenario.

Below is the required information ;

Scenario 1

Driver and middleware were built from Linux apt Package manager.

Version

Platform

LOG

Scenario 2

Driver and middleware built from current release repository : pcsc-lite-1.9.9, ccid-1.5.0 & libusb v1.0.26

Pcsc-lite configuration : --disable-libudev , --enable-libusb pcscv199.txt

Version

Platform

LOG

Scenario 3

Driver and middleware built from current release repository : pcsc-lite-1.9.9, ccid-1.5.0 & libusb v1.0.26

Pcsc-lite configuration : [default] libudev : enabled , libusb : disabled

Version

Platform

LOG

Changes of environment setup has done with proper install & removal/uninstall step. e.g: apt autoremove , make uninstall , make distclean , configure.

LudovicRousseau commented 2 years ago

In log_2.txt I only find a ACS ACR1281U reader. No OMNIKEY 5023.

I don't understand why you generate so many configurations. I don't understand why you try to use the ACS driver with the OMNIKEY reader.

In https://github.com/acshk/acsccid/issues/32 @godfreychung already said that your card is not a Mifare card.

Sukhoimaster commented 2 years ago

This is the new log for log_2(1).txt.

I take "try and error' approach with different configuration since im not very familiar with Human Interface Device integration. Thats why in my 1st scenario I build the package from the package manager . Which is very straight forward and ease for me. My thought were, by diversify the package build method will narrow down the troubleshooting step for the developer as yourself.

Really hoping the PC/SC Workgroup will meet the mission target for standardization .

Reason for having ACS driver is, im using ACR1281-u completely for my application at initial. I have 2 different smartcard version . MIFARE+ 4k & DESFIRE EV2

Then I encounter problem mentioned in acshk/acsccid#32 ; highlighting error reading DESFIRE EV2 with ISO 14443-4 A protocol using the ACR reader.

Reason for having OMNIKEY reader is because this the best available reader I can get from my area. Which was told to me that can resolve my issue with ACS reader by the merchant.

So my alternate plan is, use ACS reader for extracting securekey from SAM. Pass the extracted key to OMNIKEY Key for accessing the smart card and complete my application purpose.

Now, im having an issue with the reader driver for connecting to OMNIKEY.

I hope my clarification has been helpful.

LudovicRousseau commented 2 years ago

From log.txt (from Scenario 1) I see timeout errors:

00000147 -> 000000 65 00 00 00 00 00 05 00 00 00 
03003422 ccid_usb.c:898:ReadUSB() read failed (1/4): -7 LIBUSB_ERROR_TIMEOUT
00000463 ifdwrapper.c:364:IFDStatusICC() Card not transacted: 612

The reader does not respond to driver's commands. This is not normal. I can't do much. This reader is in the "Should work but untested by me" list https://ccid.apdu.fr/ccid/shouldwork.html#0x076B0x5023 Maybe I should move it in the "Unsupported" list.

You can try to contact HID Global OMNIKEY support. Maybe they have a reader firmware update.

Sukhoimaster commented 2 years ago

Yes , I think you should move it.

I will contact HID team to get support accordingly from them.

Thanks, very much appriciated. Will close this issue now

LudovicRousseau commented 2 years ago

The reader is now in the "Unsupported or partly supported CCID readers" list https://ccid.apdu.fr/ccid/unsupported.html#0x076B0x5023

Sukhoimaster commented 2 years ago

Hello @LudovicRousseau , after contacting with HID team.

They manage to get the HID working with the CCID release 1.4.34 pcsc_HID

The HID environment setup as below (screenshot from email reply) ; image

I did follow the same environment setup on Linux armv7 x64 but FAILED

with new error

dyn_unix.c:58:DYN_LoadLibrary() /usr/lib/pcsc/drivers/ifd-ccid-hid-global.bundle/Contents/Linux/libccid.so: /usr/lib/arm-linux-gnueabihf/libfl.so.2: undefined symbol: yylex

Included log for reference . hid_pcsc.txt pcscd log with environment setup suggested by HID .

It seem to me that the reader not respond to driver's command like you mentioned before .

Any comment from you ?

LudovicRousseau commented 2 years ago

From your log you are using the CCID driver version 1.4.30, not 1.4.34 or the latest 1.5.0.

I also see that a driver is installed in /usr/lib/pcsc/drivers/ifd-ccid-hid-global.bundle/ but failed to load.

00013524 [-1225163632] dyn_unix.c:58:DYN_LoadLibrary() /usr/lib/pcsc/drivers/ifd-ccid-hid-global.bundle/Contents/Linux/libccid.so: /usr/lib/arm-linux-gnueabihf/libfl.so.2: undefined symbol: yylex

Maybe your reader uses a firmware different than the one used by HID support team

I suggest to test on an x86 platform (standard PC with Ubuntu 22.04 for example) to eliminate possible issues with your ARM platform.

Sukhoimaster commented 2 years ago

Hey @LudovicRousseau , I have tested on an x64 platform Linux sonix 5.4.0-128-generic #144~18.04.1-Ubuntu SMP Thu Sep 22 11:08:41 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

And the driver seem to be working for HID OMNIKEY 5023 Here is the log for reference .

PC/SC Daemon ; log_pcscd.txt

in this Log im using ccid release 1.4.34 I did also test using 1.5.0 and it working flawlessly . ccid 1.5.0

pcsc-scan tools ; pcsc_scan.txt

LudovicRousseau commented 2 years ago

Your log_pcscd.txt does not contain the low level logs. But since you are able to get the card ATR I guess everything works fine.

Now you have to debug you USB stack on the beaglebone. For the Raspberry pi you should read https://ludovicrousseau.blogspot.com/2014/04/usb-issues-with-raspberry-pi.html

I moved the reader back in the "Should work" list.

Sukhoimaster commented 2 years ago

Yes , i have to debug my USB in the beaglebone. Maybe I can try the same approach with full speed mode. Ill try to dig around . Thanks.