forked from Elara6331/infinitime
Assume MTU if not available from BlueZ
This commit is contained in:
parent
062757b314
commit
24206c05f3
@ -199,7 +199,13 @@ func decode(data []byte, vals ...interface{}) error {
|
|||||||
// to send in a packet. Subtracting 20 ensures that the MTU
|
// to send in a packet. Subtracting 20 ensures that the MTU
|
||||||
// is never exceeded.
|
// is never exceeded.
|
||||||
func (blefs *FS) maxData() uint16 {
|
func (blefs *FS) maxData() uint16 {
|
||||||
return blefs.transferChar.Properties.MTU - 20
|
mtu := blefs.transferChar.Properties.MTU
|
||||||
|
// If MTU is zero, the current version of BlueZ likely
|
||||||
|
// doesn't support the MTU property, so assume 256.
|
||||||
|
if mtu == 0 {
|
||||||
|
mtu = 256
|
||||||
|
}
|
||||||
|
return mtu - 20
|
||||||
}
|
}
|
||||||
|
|
||||||
// padding returns a slice of len amount of 0x00.
|
// padding returns a slice of len amount of 0x00.
|
||||||
|
Loading…
Reference in New Issue
Block a user