| 1 |
package linux |
| 2 |
|
| 3 |
import "github.com/bettercap/gatt/linux/gioctl" |
| 4 |
|
| 5 |
const ( |
| 6 |
ioctlSize = uintptr(4) |
| 7 |
hciMaxDevices = 16 |
| 8 |
typHCI = 72 |
| 9 |
) |
| 10 |
|
| 11 |
var ( |
| 12 |
hciUpDevice = gioctl.IoW(typHCI, 201, ioctlSize) |
| 13 |
hciDownDevice = gioctl.IoW(typHCI, 202, ioctlSize) |
| 14 |
hciResetDevice = gioctl.IoW(typHCI, 203, ioctlSize) |
| 15 |
hciGetDeviceList = gioctl.IoR(typHCI, 210, ioctlSize) |
| 16 |
hciGetDeviceInfo = gioctl.IoR(typHCI, 211, ioctlSize) |
| 17 |
) |
| 18 |
|
| 19 |
type devRequest struct { |
| 20 |
id uint16 |
| 21 |
opt uint32 |
| 22 |
} |
| 23 |
|
| 24 |
type devListRequest struct { |
| 25 |
devNum uint16 |
| 26 |
devRequest [hciMaxDevices]devRequest |
| 27 |
} |
| 28 |
|
| 29 |
type hciDevInfo struct { |
| 30 |
id uint16 |
| 31 |
name [8]byte |
| 32 |
bdaddr [6]byte |
| 33 |
flags uint32 |
| 34 |
devType uint8 |
| 35 |
features [8]uint8 |
| 36 |
pktType uint32 |
| 37 |
linkPolicy uint32 |
| 38 |
linkMode uint32 |
| 39 |
aclMtu uint16 |
| 40 |
aclPkts uint16 |
| 41 |
scoMtu uint16 |
| 42 |
scoPkts uint16 |
| 43 |
|
| 44 |
stats hciDevStats |
| 45 |
} |
| 46 |
|
| 47 |
type hciDevStats struct { |
| 48 |
errRx uint32 |
| 49 |
errTx uint32 |
| 50 |
cmdTx uint32 |
| 51 |
evtRx uint32 |
| 52 |
aclTx uint32 |
| 53 |
aclRx uint32 |
| 54 |
scoTx uint32 |
| 55 |
scoRx uint32 |
| 56 |
byteRx uint32 |
| 57 |
byteTx uint32 |
| 58 |
} |