paypal / gatt

Gatt is a Go package for building Bluetooth Low Energy peripherals
BSD 3-Clause "New" or "Revised" License
1.14k stars 285 forks source link

LEAdvertisingReportEP Unmarshal slice bounds out of range with d.Scan( , true) #89

Open m-ivanov opened 7 years ago

m-ivanov commented 7 years ago

d.Scan([]gatt.UUID{}, true)

panic: runtime error: slice bounds out of range

goroutine 24 [running]:
github.com/paypal/gatt/linux/evt.(*LEAdvertisingReportEP).Unmarshal(0x1041f790, 0x1046e07e, 0x14, 0x14, 0x0, 0x0)
    /root/go/src/github.com/paypal/gatt/linux/evt/evt.go:327 +0x5b0
github.com/paypal/gatt/linux.(*HCI).handleAdvertisement(0x10442300, 0x1046e053, 0x3f, 0x3f)
    /root/go/src/github.com/paypal/gatt/linux/hci.go:247 +0x54
created by github.com/paypal/gatt/linux.(*HCI).handleLEMeta
    /root/go/src/github.com/paypal/gatt/linux/hci.go:359 +0x11c
aroxarox commented 6 years ago

Got same problem with an NTC Chip device although it works with RPI : it seems the unmarshal function do not aggre with the order used to multiplex report. I have it working by replacing all loops on NumReports by a single loop. But I dont know if the problem come from the code, some change in protocol or firmware on BT Chip ?

The RPI always send single AdvertisingReport so I can say who is right.

Preston-PLB commented 6 years ago

Having a similar problem with a Bluetooth OBD scanner but not a smartwatch. Any advice on how to fix?