Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix l2cap segmentation error in concurrent subscription #28

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion central_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package gatt
import (
"sync"

"github.com/bettercap/gatt/xpc"
"github.com/lightblox/gatt/xpc"
)

type central struct {
Expand Down
4 changes: 2 additions & 2 deletions device_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"encoding/binary"
"errors"
"fmt"
"log"
log "github.com/sirupsen/logrus"
"sync"
"time"

"github.com/bettercap/gatt/xpc"
"github.com/lightblox/gatt/xpc"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions device_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/binary"
"net"

"github.com/bettercap/gatt/linux"
"github.com/bettercap/gatt/linux/cmd"
"github.com/lightblox/gatt/linux"
"github.com/lightblox/gatt/linux/cmd"
)

type device struct {
Expand Down
7 changes: 4 additions & 3 deletions examples/discoverer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ package main

import (
"fmt"
"log"

"github.com/bettercap/gatt"
"github.com/bettercap/gatt/examples/option"
log "github.com/sirupsen/logrus"

"github.com/lightblox/gatt"
"github.com/lightblox/gatt/examples/option"
)

func onStateChanged(d gatt.Device, s gatt.State) {
Expand Down
4 changes: 2 additions & 2 deletions examples/explorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"strings"
"time"

"github.com/bettercap/gatt"
"github.com/bettercap/gatt/examples/option"
"github.com/lightblox/gatt"
"github.com/lightblox/gatt/examples/option"
)

var done = make(chan struct{})
Expand Down
2 changes: 1 addition & 1 deletion examples/option/option_darwin.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package option

import "github.com/bettercap/gatt"
import "github.com/lightblox/gatt"

var DefaultClientOptions = []gatt.Option{
gatt.MacDeviceRole(gatt.CentralManager),
Expand Down
4 changes: 2 additions & 2 deletions examples/option/option_linux.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package option

import (
"github.com/bettercap/gatt"
"github.com/bettercap/gatt/linux/cmd"
"github.com/lightblox/gatt"
"github.com/lightblox/gatt/linux/cmd"
)

var DefaultClientOptions = []gatt.Option{
Expand Down
9 changes: 5 additions & 4 deletions examples/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ package main

import (
"fmt"
"log"

"github.com/bettercap/gatt"
"github.com/bettercap/gatt/examples/option"
"github.com/bettercap/gatt/examples/service"
log "github.com/sirupsen/logrus"

"github.com/lightblox/gatt"
"github.com/lightblox/gatt/examples/option"
"github.com/lightblox/gatt/examples/service"
)

func main() {
Expand Down
9 changes: 5 additions & 4 deletions examples/server_lnx.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"bytes"
"flag"
"fmt"
"log"
"time"

"github.com/bettercap/gatt"
"github.com/bettercap/gatt/examples/service"
"github.com/bettercap/gatt/linux/cmd"
log "github.com/sirupsen/logrus"

"github.com/lightblox/gatt"
"github.com/lightblox/gatt/examples/service"
"github.com/lightblox/gatt/linux/cmd"
)

// server_lnx implements a GATT server.
Expand Down
2 changes: 1 addition & 1 deletion examples/service/battery.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package service

import "github.com/bettercap/gatt"
import "github.com/lightblox/gatt"

func NewBatteryService() *gatt.Service {
lv := byte(100)
Expand Down
5 changes: 3 additions & 2 deletions examples/service/count.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package service

import (
"fmt"
"log"
"time"

"github.com/bettercap/gatt"
log "github.com/sirupsen/logrus"

"github.com/lightblox/gatt"
)

func NewCountService() *gatt.Service {
Expand Down
2 changes: 1 addition & 1 deletion examples/service/gap.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package service

import "github.com/bettercap/gatt"
import "github.com/lightblox/gatt"

var (
attrGAPUUID = gatt.UUID16(0x1800)
Expand Down
2 changes: 1 addition & 1 deletion examples/service/gatt.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package service
import (
"log"

"github.com/bettercap/gatt"
"github.com/lightblox/gatt"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module github.com/bettercap/gatt
module github.com/lightblox/gatt

go 1.13

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0 // indirect
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
Expand Down
14 changes: 5 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,33 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab h1:n8cgpHzJ5+EDyDri2s/GC7a9+qK3/YEGnBsd0uS/8PY=
github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab/go.mod h1:y1pL58r5z2VvAjeG1VLGc8zOQgSOzbKN7kMHPvFXJ+8=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3 h1:5B6i6EAiSYyejWfvc5Rc9BbI3rzIsrrXfAQBWnYfn+w=
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 h1:F5Gozwx4I1xtr/sr/8CFbb57iKi3297KFs0QDbGN60A=
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
11 changes: 6 additions & 5 deletions linux/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"errors"
"fmt"
"io"
"log"

"github.com/bettercap/gatt/linux/evt"
"github.com/bettercap/gatt/linux/util"
log "github.com/sirupsen/logrus"

"github.com/lightblox/gatt/linux/evt"
"github.com/lightblox/gatt/linux/util"
)

type CmdParam interface {
Expand Down Expand Up @@ -140,9 +141,9 @@ const (
hostCtl = 0x03
infoParam = 0x04
statusParam = 0x05
testingCmd = 0X3E
testingCmd = 0x3E
leCtl = 0x08
vendorCmd = 0X3F
vendorCmd = 0x3F
)

const (
Expand Down
7 changes: 4 additions & 3 deletions linux/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package linux

import (
"errors"
"log"
"sync"
"syscall"
"unsafe"

"github.com/bettercap/gatt/linux/gioctl"
"github.com/bettercap/gatt/linux/socket"
log "github.com/sirupsen/logrus"

"github.com/lightblox/gatt/linux/gioctl"
"github.com/lightblox/gatt/linux/socket"
"golang.org/x/sys/unix"
)

Expand Down
2 changes: 1 addition & 1 deletion linux/devices.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package linux

import "github.com/bettercap/gatt/linux/gioctl"
import "github.com/lightblox/gatt/linux/gioctl"

const (
ioctlSize = uintptr(4)
Expand Down
2 changes: 1 addition & 1 deletion linux/evt/evt.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"fmt"

"github.com/bettercap/gatt/linux/util"
"github.com/lightblox/gatt/linux/util"
)

type EventHandler interface {
Expand Down
9 changes: 5 additions & 4 deletions linux/hci.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package linux
import (
"fmt"
"io"
"log"
"sync"

"github.com/bettercap/gatt/linux/cmd"
"github.com/bettercap/gatt/linux/evt"
"github.com/bettercap/gatt/linux/util"
log "github.com/sirupsen/logrus"

"github.com/lightblox/gatt/linux/cmd"
"github.com/lightblox/gatt/linux/evt"
"github.com/lightblox/gatt/linux/util"
"golang.org/x/sys/unix"
)

Expand Down
Loading