accounts/scwallet: use default path from pcsclite

This commit is contained in:
Guillaume Ballet 2019-05-28 13:22:44 +02:00
parent 3b73f1a6d9
commit b8a964dfcf
2 changed files with 11 additions and 21 deletions

View file

@ -25,7 +25,6 @@ import (
"math/big"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"time"
@ -58,6 +57,7 @@ import (
"github.com/ethereum/go-ethereum/p2p/netutil"
"github.com/ethereum/go-ethereum/params"
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
pcsclite "github.com/gballet/go-libpcsclite"
cli "gopkg.in/urfave/cli.v1"
)
@ -131,7 +131,7 @@ var (
SmartCardFlag = cli.StringFlag{
Name: "pcscd-sock",
Usage: "Path to the smartcard daemon (pcscd) socket file (unix only, leave empty for platform default)",
Value: "",
Value: pcsclite.PCSCDSockName,
}
NetworkIdFlag = cli.Uint64Flag{
Name: "networkid",
@ -1151,10 +1151,6 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
}
func setSmartCard(ctx *cli.Context, cfg *node.Config) {
// No support for windows, currently
if runtime.GOOS != "windows" {
cfg.SmartCard = true
// Use the platform default unless specified on the command line
if len(ctx.GlobalString(SmartCardFlag.Name)) > 0 {
if fi, err := os.Stat(ctx.GlobalString(SmartCardFlag.Name)); err == nil {
@ -1167,9 +1163,6 @@ func setSmartCard(ctx *cli.Context, cfg *node.Config) {
log.Error(fmt.Sprintf("%s doesn't exist", ctx.GlobalString(SmartCardFlag.Name)))
}
}
} else {
log.Info("Smartcard support disabled on this platform")
}
}
func setDataDir(ctx *cli.Context, cfg *node.Config) {

View file

@ -95,9 +95,6 @@ type Config struct {
// NoUSB disables hardware wallet monitoring and connectivity.
NoUSB bool `toml:",omitempty"`
// SmartCard activates smartcard wallet monitoring and connectivity.
SmartCard bool `toml:",omitempty"`
// SmartCardDaemonPath is the path to the smartcard daemon's socket
SmartCardDaemonPath string `toml:",omitempty"`
@ -511,7 +508,7 @@ func makeAccountManager(conf *Config) (*accounts.Manager, string, error) {
backends = append(backends, trezorhub)
}
}
if conf.SmartCard {
if len(conf.SmartCardDaemonPath) > 0 {
// Start a smart card hub
if schub, err := scwallet.NewHub(conf.SmartCardDaemonPath, scwallet.Scheme, keydir); err != nil {
log.Warn(fmt.Sprintf("Failed to start smart card hub, disabling: %v", err))