mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 04:52:10 -07:00
fix: fixed device index use for BLE module (fixes #994)
This commit is contained in:
parent
93de427f9a
commit
76e136a18e
3 changed files with 11 additions and 6 deletions
|
@ -4,8 +4,10 @@ import (
|
||||||
"github.com/bettercap/gatt"
|
"github.com/bettercap/gatt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultBLEClientOptions = []gatt.Option{
|
func getClientOptions(deviceID int) []gatt.Option {
|
||||||
gatt.MacDeviceRole(gatt.CentralManager),
|
return []gatt.Option{
|
||||||
|
gatt.MacDeviceRole(gatt.CentralManager),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -5,9 +5,11 @@ import (
|
||||||
// "github.com/bettercap/gatt/linux/cmd"
|
// "github.com/bettercap/gatt/linux/cmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
var defaultBLEClientOptions = []gatt.Option{
|
func getClientOptions(deviceID int) []gatt.Option {
|
||||||
gatt.LnxMaxConnections(255),
|
return []gatt.Option{
|
||||||
gatt.LnxDeviceID(-1, true),
|
gatt.LnxMaxConnections(255),
|
||||||
|
gatt.LnxDeviceID(deviceID, true),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build !windows
|
||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
package ble
|
package ble
|
||||||
|
@ -166,7 +167,7 @@ func (mod *BLERecon) Configure() (err error) {
|
||||||
golog.SetFlags(0)
|
golog.SetFlags(0)
|
||||||
golog.SetOutput(dummyWriter{mod})
|
golog.SetOutput(dummyWriter{mod})
|
||||||
|
|
||||||
if mod.gattDevice, err = gatt.NewDevice(defaultBLEClientOptions...); err != nil {
|
if mod.gattDevice, err = gatt.NewDevice(getClientOptions(mod.deviceId)...); err != nil {
|
||||||
mod.Debug("error while creating new gatt device: %v", err)
|
mod.Debug("error while creating new gatt device: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue