Skip to content

Commit

Permalink
Merge pull request #2 from ZondaX/fix/LinuxWin
Browse files Browse the repository at this point in the history
Fixes for Linux and Windows
  • Loading branch information
jleni committed Jan 29, 2019
2 parents 5271d68 + 9d7fdc7 commit 35b79a1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 32 deletions.
33 changes: 12 additions & 21 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[[constraint]]
name = "github.com/karalabe/hid"
branch = "master"
name = "github.com/ZondaX/hid"
version = "0.9.0"

[[constraint]]
name = "github.com/pkg/errors"
Expand All @@ -14,5 +14,5 @@
go-tests = true
unused-packages = true
[[prune.project]]
name = "github.com/karalabe/hid"
name = "github.com/ZondaX/hid"
unused-packages = false
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ install:
- dep ensure -v

build_script:
- go build ledger.go apduWrapper.go
- go build -x ledger.go apduWrapper.go
- go test
11 changes: 10 additions & 1 deletion ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package ledger_go
import (
"errors"
"fmt"
"github.com/karalabe/hid"
"github.com/ZondaX/hid"
"sync"
)

Expand Down Expand Up @@ -77,6 +77,15 @@ func FindLedger() (*Ledger, error) {
}
return NewLedger(device), nil
}

// Linux discovery
if d.VendorID == VendorLedger && d.Product == "Nano S" && d.Interface == 0 {
device, err := d.Open()
if err != nil {
return nil, err
}
return NewLedger(device), nil
}
}
return nil, errors.New("no ledger connected")
}
Expand Down
8 changes: 2 additions & 6 deletions ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ package ledger_go
import (
"encoding/hex"
"fmt"
"github.com/ZondaX/hid-go"
"github.com/ZondaX/hid"
"github.com/stretchr/testify/assert"
"testing"
)

func Test_ThereAreDevices(t *testing.T) {
devices, err := hid.Devices()
if err != nil {
fmt.Printf("Error: %s", err)
}

devices := hid.Enumerate(0, 0)
assert.NotEqual(t, 0, len(devices))
}

Expand Down

0 comments on commit 35b79a1

Please sign in to comment.