@@ -262,7 +262,7 @@ func (h *hci) processPacket() (bool, error) {
262
262
return false , nil
263
263
case h .pos >= hciACLLenPos + pktlen :
264
264
if debug {
265
- println ("hci acl data:" , h .pos , hex .EncodeToString (h .buf [:hciACLLenPos + pktlen + 1 ]))
265
+ println ("hci acl data recv :" , h .pos , hex .EncodeToString (h .buf [:hciACLLenPos + pktlen + 1 ]))
266
266
}
267
267
268
268
h .pos = hciACLLenPos + pktlen + 1
@@ -280,7 +280,7 @@ func (h *hci) processPacket() (bool, error) {
280
280
return false , nil
281
281
case h .pos >= hciEvtLenPos + pktlen :
282
282
if debug {
283
- println ("hci event data:" , h .pos , hex .EncodeToString (h .buf [:hciEvtLenPos + pktlen + 1 ]))
283
+ println ("hci event data recv :" , h .pos , hex .EncodeToString (h .buf [:hciEvtLenPos + pktlen + 1 ]))
284
284
}
285
285
286
286
h .pos = hciEvtLenPos + pktlen + 1
@@ -293,7 +293,7 @@ func (h *hci) processPacket() (bool, error) {
293
293
if h .pos > 3 {
294
294
pktlen := int (h .buf [3 ])
295
295
if debug {
296
- println ("hci synchronous data:" , h .pos , pktlen , hex .EncodeToString (h .buf [:1 + 3 + pktlen ]))
296
+ println ("hci synchronous data recv :" , h .pos , pktlen , hex .EncodeToString (h .buf [:1 + 3 + pktlen ]))
297
297
}
298
298
299
299
// move to next packet
@@ -304,7 +304,7 @@ func (h *hci) processPacket() (bool, error) {
304
304
305
305
default :
306
306
if debug {
307
- println ("unknown packet data:" , h .pos , h .end , hex .EncodeToString (h .buf [:h .pos ]))
307
+ println ("unknown packet data recv :" , h .pos , h .end , hex .EncodeToString (h .buf [:h .pos ]))
308
308
}
309
309
return true , ErrHCIUnknown
310
310
}
@@ -678,7 +678,11 @@ func (h *hci) handleEventData(buf []byte) error {
678
678
switch buf [2 ] {
679
679
case leMetaEventConnComplete , leMetaEventEnhancedConnectionComplete :
680
680
if debug {
681
- println ("leMetaEventConnComplete" )
681
+ if buf [2 ] == leMetaEventConnComplete {
682
+ println ("leMetaEventConnComplete" , hex .EncodeToString (buf ))
683
+ } else {
684
+ println ("leMetaEventEnhancedConnectionComplete" , hex .EncodeToString (buf ))
685
+ }
682
686
}
683
687
684
688
h .connectData .connected = true
@@ -691,10 +695,10 @@ func (h *hci) handleEventData(buf []byte) error {
691
695
switch buf [2 ] {
692
696
case leMetaEventConnComplete :
693
697
h .connectData .interval = binary .LittleEndian .Uint16 (buf [14 :])
694
- h .connectData .timeout = binary .LittleEndian .Uint16 (buf [16 :])
698
+ h .connectData .timeout = binary .LittleEndian .Uint16 (buf [18 :])
695
699
case leMetaEventEnhancedConnectionComplete :
696
700
h .connectData .interval = binary .LittleEndian .Uint16 (buf [26 :])
697
- h .connectData .timeout = binary .LittleEndian .Uint16 (buf [28 :])
701
+ h .connectData .timeout = binary .LittleEndian .Uint16 (buf [30 :])
698
702
}
699
703
700
704
h .att .addConnection (h .connectData .handle )
0 commit comments