channels/smartcard: refactoring