GithubHelp home page GithubHelp logo

go.pcsclite's People

Contributors

a2800276 avatar ebfe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

go.pcsclite's Issues

Specify the license

Hi @ebfe,
I'm unable to find any licensing info in your repo. Right now your work is non-free software.
Could you please specify the license?

Thanks.

function ends without a return statement

With go1 (default on ubuntu)

go get github.com/ebfe/go.pcsclite/scard
# github.com/ebfe/go.pcsclite/scard
scard.go:85[/tmp/go-build170868432/github.com/ebfe/go.pcsclite/scard/_obj/scard.cgo1.go:107]: function ends without a return statement

Indeed, in this function, all the retuen are inside the switch, adding on at the end would probably solve the trouble.

scard: Cannot find a smart card reader

I'm trying to write a small Go program to talk to my Yubikey Neo, but I'm having trouble getting go.pcsclite to recognise it.

I've installed pcsc-lite via Homebrew (v1.8.13), and I know the Yubikey is plugged in and working because pcsctest, opensc-tool, ykinfo and ykneomgr can all see it.

❯ pcsctest

MUSCLE PC/SC Lite Test Program

Testing SCardEstablishContext    : Command successful.
Testing SCardGetStatusChange
Please insert a working reader   : Command successful.
Testing SCardListReaders         : Command successful.
Reader 01: Yubico Yubikey NEO OTP+CCID
❯ opensc-tool --list-readers
# Detected readers (pcsc)
Nr.  Card  Features  Name
0    Yes             Yubico Yubikey NEO OTP+CCID
❯ ykinfo -a
serial: 1234567
serial_hex: a1b2c3
serial_modhex: modhex
version: 3.3.0
touch_level: 1551
programming_sequence: 3
slot1_status: 1
slot2_status: 1
vendor_id: 1050
product_id: 111
❯ ykneomgr --list-readers
0: Yubico Yubikey NEO OTP+CCID

My program looks like this:

package main

import (
  "fmt"
  "github.com/ebfe/go.pcsclite/scard"
)

func main() {
  ctx, err := scard.EstablishContext()
  if err != nil {
    panic(err)
  }
  readers, err := ctx.ListReaders()
  if err != nil {
    panic(err)
  }
  fmt.Println(readers)
}

The error I'm seeing is this:

❯ go build && ./yubigo-oath
panic: scard: Cannot find a smart card reader.

goroutine 16 [running]:
runtime.panic(0x40bca20, 0x8010002e)
        /brew/Cellar/go/1.3.3/libexec/src/pkg/runtime/panic.c:279 +0xf5
main.main()
        /Users/james/Projects/jamesottaway/yubigo-oath/main.go:15 +0xd3

I'm running pcscd in debug mode, and it gives the following output:

❯ sudo pcscd -fd
00000000 debuglog.c:292:DebugLogSetLevel() debug level=debug
00000089 configfile.l:355:DBGetReaderList() Parsing conf file: /brew/Cellar/pcsc-lite/1.8.13/etc/reader.conf.d
00000008 pcscdaemon.c:569:main() pcsc-lite 1.8.13 daemon ready.
09077573 winscard_msg_srv.c:253:ProcessEventsServer() Common channel packet arrival
00000024 winscard_msg_srv.c:265:ProcessEventsServer() ProcessCommonChannelRequest detects: 5
00000005 pcscdaemon.c:134:SVCServiceRunLoop() A new context thread creation is requested: 5
00000052 winscard_svc.c:331:ContextThread() Authorized PC/SC client
00000005 winscard_svc.c:335:ContextThread() Thread is started: dwClientID=5, threadContext @0x7ff749e0a8d0
00000012 winscard_svc.c:353:ContextThread() Received command: CMD_VERSION from client 5
00000005 winscard_svc.c:365:ContextThread() Client is protocol version 4:3
00000002 winscard_svc.c:385:ContextThread() CMD_VERSION rv=0x0 for client 5
00000064 winscard_svc.c:353:ContextThread() Received command: ESTABLISH_CONTEXT from client 5
00000256 winscard.c:216:SCardEstablishContext() Establishing Context: 0x18A4445A
00000016 winscard_svc.c:446:ContextThread() ESTABLISH_CONTEXT rv=0x0 for client 5
00000076 winscard_svc.c:353:ContextThread() Received command: CMD_GET_READERS_STATE from client 5
00000631 winscard_svc.c:345:ContextThread() Client die: 5
00000014 winscard.c:227:SCardReleaseContext() Releasing Context: 0x18A4445A
00000008 winscard_svc.c:978:MSGCleanupClient() Thread is stopping: dwClientID=5, threadContext @0x7ff749e0a8d0
00000004 winscard_svc.c:984:MSGCleanupClient() Freeing SCONTEXT @0x7ff749e0a8d0

Is there something I'm missing here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.