Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Smartcard reader, pcscd and usbfs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Wed Oct 06, 2021 4:21 am    Post subject: [Solved] Smartcard reader, pcscd and usbfs Reply with quote

Two computers. One can read the smartcard and the other cannot. Can't figure out what is missing.
USB smartcard reader. I plug it in, insert the card and start pcscd. In working computer lsusb output shows Driver=usbfs, when I stop pcscd the driver unloads. The other, non-working computer:
Code:
    |__ Port 2: Dev 8, If 0, Class=Chip/SmartCard, Driver=, 12M

No driver attached. Applications tell no smartcard reader found.
Can't find anything different in kernel configuration. USE flags are the same for pcscd and gnupg. I've spent a few hours now reading the docs and trying.
Ideas where to look are welcome. :roll:
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!


Last edited by Jaglover on Thu Oct 07, 2021 9:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
roccobaroccoSC
n00b
n00b


Joined: 15 May 2020
Posts: 27

PostPosted: Wed Oct 06, 2021 6:48 am    Post subject: Reply with quote

Did you compare the two kernel configurations? Make a diff of them by copying the contents of /proc/config.gz to two text files.
Edit: sorry, just saw you DID compare the kernel configs.

Is the hardware identical?
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 806

PostPosted: Wed Oct 06, 2021 8:19 am    Post subject: Reply with quote

Here is quite some software that is needed to make smartcards work (besides the application you want to use):
- sys-apps/pcsc-lite
- dev-libs/opensc
- dev-libs/openct
- app-crypt/ccid
Can you check if they are all available with the same use flags?
Usually the usb USE flag for app-cypt/ccid and the udev USE flag for pcsc-lite are required to make it work.

For USB smartcard readers the /dev/usb/ devices are used so i don't expect any kernel driver issue. You can use the command opensc-tool -l to get a list of smartcard readers found on your system.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Wed Oct 06, 2021 10:04 am    Post subject: Reply with quote

Thanks for replies.

Hardware is not identical. The box which does not work is older, has USB-1 port in front, using UHCI.

pcsc-lite and opensc have same use flags, openct and ccid are not installed in working box.

Scanning with pcsc_scan does not find the reader in non-working box.

When I start pcscd in working box I get a mile long spam in dmesg:

Code:
usb 1-1: usbfs: process 5185 (pcscd) did not claim interface 0 before use


When I start pcscd in non-working box there is nothing in dmesg.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 806

PostPosted: Wed Oct 06, 2021 1:39 pm    Post subject: Reply with quote

My own smartcard uses "usbfs" as it's driver, as far as i know it's a non-optional part of usbcore so that should be available.

Since you mention different types of USB, have you included all xHCI drivers for the different types of USB in your kernel? Does the USB port work with other hardware (like a regular USB stick)?
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Wed Oct 06, 2021 5:27 pm    Post subject: Reply with quote

Only UHCI and EHCI are enabled currently. The port in front is functional, the reader shows up in lsusb. I think I'll try it in the back next, with USB-2. I see usbfs in /sys/module/usbcore/drivers/, so I guess the kernel is OK.
The last resort is going to be booting from Ubuntu USB stick and investigate what it does when I plug the card reader in.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 806

PostPosted: Thu Oct 07, 2021 6:08 am    Post subject: Reply with quote

Can you post the USE flags for the packages involved? (sys-apps/pcsc-lite, dev-libs/opensc, dev-libs/openct and app-crypt/ccid).

If you don't have app-crypt/ccid installed, my first guess would be to install that. Make sure to set the usb USE flag.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Thu Oct 07, 2021 10:01 pm    Post subject: Reply with quote

It is working. I installed app-crypt/ccid. Note, the other box was working without ccid. Now I wonder why ...
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 806

PostPosted: Fri Oct 08, 2021 6:44 am    Post subject: Reply with quote

Good to hear it's working now.

ccid installs just a few files, could it be you installed those files manually (without portage) on the other system? or maybe some vendor provided driver?
Really working without ccid is sort-of impossible since it is the driver pcsc needs to access your hardware.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Fri Oct 08, 2021 3:33 pm    Post subject: Reply with quote

Thanks for your assistance. :) Can't do any tests, she was so happy it works she practically confiscated the reader.

Off topic question. Does anyone know if they make internal CAC readers, to fit into laptop-size CD reader bay?
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 806

PostPosted: Fri Oct 08, 2021 5:12 pm    Post subject: Reply with quote

LOL, good she's happy.

I'm not sure it's even possible. The interface is usually sata, and i've never seen any sata based readers. In case there is USB in there somehow, i guess DIY is your best chance. You can buy an empty HDD-tray and you might be able to fit a USB based reader in there somehow.

I have a similar question:
I have a PC Engines apu4d4 (https://pcengines.ch/apu4d4.htm) in use as a router, it has two miniPCI express slots wired with both USB and a SIM slot on the mainboard (which is the same as a regular smartcard slot). If i'd have a miniPCI express reader which connects to the USB and SIM connections provided by the miniPCI express that would really be a neat solution. However, i haven't been able to find something like that. Does anyone if a product like that exists?
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Fri Oct 08, 2021 7:24 pm    Post subject: Reply with quote

Yes I figured although there may exist other than USB com methods for readers SATA is hardly the one. I think I saw a laptop CAC reader somewhere yesterday, it was just a PCB. If I can find it again I may be able to put it into a CD drive case. Her computer is not a laptop, it is one of those HP office mini PC's, with slim CD drive. Once I have the reader in there making a USB connection won't be hard.

What you need the reader for in your router? For OS? (I haven't seen one you are thinking of.) But then again, if they have USB and SIM provided to the slot, what for? There must be something in existence for it.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 806

PostPosted: Sat Oct 09, 2021 5:49 am    Post subject: Reply with quote

If it's not a laptop things could be easier. I've seen smartcard readers in brackets to fit 3.5" drive bays, maybe one exists for slimline 5.25" too.

The intended purpose (from PC Engines) for the SIM slots on my router is a mobile data connection. In that case there is a 2G/3G/4G/5G module in the miniPCI express slot and it can use the SIM card slot for the actual SIM card. My own use case it so have VPN's with smartcards, there is a topic on that subject here on the forums: https://forums.gentoo.org/viewtopic-t-1114346.html
Right now i'm using two USB crypto tokens (basically smartcards+reader in USB stick form factor) connected to external USB ports. It works, but using the internal slots would be nicer.
_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum