@@ -262,7 +262,7 @@ func (h *hci) processPacket() (bool, error) {
262262 return false , nil
263263 case h .pos >= hciACLLenPos + pktlen :
264264 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 ]))
266266 }
267267
268268 h .pos = hciACLLenPos + pktlen + 1
@@ -280,7 +280,7 @@ func (h *hci) processPacket() (bool, error) {
280280 return false , nil
281281 case h .pos >= hciEvtLenPos + pktlen :
282282 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 ]))
284284 }
285285
286286 h .pos = hciEvtLenPos + pktlen + 1
@@ -293,7 +293,7 @@ func (h *hci) processPacket() (bool, error) {
293293 if h .pos > 3 {
294294 pktlen := int (h .buf [3 ])
295295 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 ]))
297297 }
298298
299299 // move to next packet
@@ -304,7 +304,7 @@ func (h *hci) processPacket() (bool, error) {
304304
305305 default :
306306 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 ]))
308308 }
309309 return true , ErrHCIUnknown
310310 }
@@ -678,7 +678,11 @@ func (h *hci) handleEventData(buf []byte) error {
678678 switch buf [2 ] {
679679 case leMetaEventConnComplete , leMetaEventEnhancedConnectionComplete :
680680 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+ }
682686 }
683687
684688 h .connectData .connected = true
@@ -691,10 +695,10 @@ func (h *hci) handleEventData(buf []byte) error {
691695 switch buf [2 ] {
692696 case leMetaEventConnComplete :
693697 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 :])
695699 case leMetaEventEnhancedConnectionComplete :
696700 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 :])
698702 }
699703
700704 h .att .addConnection (h .connectData .handle )
0 commit comments