[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bluetooth-dev] Modif of function hci_receive_bcsp : strange behavior



Hi all,

I made some modifications to support big endian systems. I modified function hci_read_firmware_rev_info. The command is well recognized on bid endian systems. But of course function hci_receive_bcsp return a "Not a GETRESP msg" error. So I tried to correct it.

I pass every field of the record to a le16_to_cpu function. This work well, I haven't the "Not a GETRESP msg" any more. The initialization go well until the end.

Now, the module continue to send bytes after the initialization ended if I corrected the function hci_receive_bcsp.
It is like if the module didn't recieve an acknowledge and it tries to re-send informations after the initialization ended... but I don't understand why changing hci_receive_bcsp can provocate such a behavior.

Here are the logs. The first one is without to modify hci_receive_bcsp() function, and the second one is after having modified hci_receive_bcsp() function.

I added some debug, because I notice that the message "seq out-of-order [exp:3, got:0], send ack" appears if variables "expected_rxseq" and function "BCSP_GET_SEQ(bcsp)" are not equal.

Every advice or ideas while this problem occurs will be appreciated.

--- First logs, original hci_receive_bcsp() function --

BT SYS: Setting BT driver to use serial tty
BT SYS: Initialising Bluetooth Stack
BT SYS: Current HW: CSR
BT SYS: Initialising BTMEM [2500 bytes]
BT SYS: Initializing BCSP
BT SYS: BCSP initialized and syncronized
HCI: csr_waitcmdnum
Value of expected_rxseq : 0
BCSP_GET_SEQ(bcsp) : 0

process_event (4):
0x00 0x01 0x00 0x00 
HCI: release_cmd_timer
HCI: process_event: COMMAND_STATUS
BT SYS: Initialising HCI
BT SYS: HCI emulator off
BT SYS: Initialising HCI inbuffers [800]
BT SYS: Reading buffer sizes in HW module
HCI: hci_read_buffer_size

send_cmd_queue:  (4):
0x01 0x05 0x10 0x00 
Value of expected_rxseq : 1
BCSP_GET_SEQ(bcsp) : 1

process_event (11):
0x01 0x05 0x10 0x00 0xc0 0x00 0x40 0x08 0x00 0x08 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: READ_BUFFER_SIZE

HW module contains...
8 ACL buffers at 192 bytes
8 SCO buffers at 64 bytes

BT SYS: Reading firmware info in HW module
HCI: hci_read_firmware_rev_info [CSR] BuildID/ChipVer/ChipRev

send_cmd_queue:  (27):
0x01 0x00 0xfc 0x17 0xc2 0x00 0x00 0x0b 0x00 0x00 0x00 0x19 0x28 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
Value of expected_rxseq : 2
BCSP_GET_SEQ(bcsp) : 2
HCI: release_cmd_timer
BT SYS: hci_receive_bcsp: Not a GETRESP msg

hci_receive_bcsp (22):
0x01 0x00 0x0b 0x00 0x00 0x00 0x19 0x28 0x00 0x00 0xbc 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 

send_cmd_queue:  (27):
0x01 0x00 0xfc 0x17 0xc2 0x00 0x00 0x0b 0x00 0x01 0x00 0x1a 0x28 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
Value of expected_rxseq : 3
BCSP_GET_SEQ(bcsp) : 3
HCI: release_cmd_timer
BT SYS: hci_receive_bcsp: Not a GETRESP msg

hci_receive_bcsp (22):
0x01 0x00 0x0b 0x00 0x01 0x00 0x1a 0x28 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 

send_cmd_queue:  (27):
0x01 0x00 0xfc 0x17 0xc2 0x00 0x00 0x0b 0x00 0x02 0x00 0x1b 0x28 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
Value of expected_rxseq : 4
BCSP_GET_SEQ(bcsp) : 4
HCI: release_cmd_timer
BT SYS: hci_receive_bcsp: Not a GETRESP msg

hci_receive_bcsp (22):
0x01 0x00 0x0b 0x00 0x02 0x00 0x1b 0x28 0x00 0x00 0x65 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 
BT SYS: Host flow control not enabled
BT SYS: M/S switch disabled
BT SYS: Force M/S switch set to 0
BT SYS: Initialising L2CAP
HCI: hci_read_local_bd

send_cmd_queue:  (4):
0x01 0x09 0x10 0x00 
Value of expected_rxseq : 5
BCSP_GET_SEQ(bcsp) : 5

process_event (10):
0x01 0x09 0x10 0x00 0x83 0x12 0x00 0x61 0x07 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: READ_BD_ADDR

process_return_param: READ_BD_ADDR :  (6):
0x83 0x12 0x00 0x61 0x07 0x00 
BT SYS: Local bd [00:07:61:00:12:83]
BT SYS: Initialising RFCOMM
BT SYS: Initialising SDP
BT SYS: Init SDP as server
BT SYS: Initialising TCS
BT SYS: Initialising TEST
HCI: hci_write_class_of_device: Service class 0x10, major:0x3, minor:0x0
HCI: hci_write_class_of_device: 2:3:0

send_cmd_queue:  (7):
0x01 0x24 0x0c 0x03 0x00 0x03 0x02 
Value of expected_rxseq : 6
BCSP_GET_SEQ(bcsp) : 6

process_event (4):
0x01 0x24 0x0c 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: WRITE_CLASS_OF_DEVICE
HCI: hci_change_local_name: New name: Remora

send_cmd_queue:  (252):
0x01 0x13 0x0c 0xf8 0x52 0x65 0x6d 0x6f 0x72 0x61 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
Value of expected_rxseq : 7
BCSP_GET_SEQ(bcsp) : 7

process_event (4):
0x01 0x13 0x0c 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: CHANGE_LOCAL_NAME
HCI: hci_write_scan_enable: enable 3

send_cmd_queue:  (5):
0x01 0x1a 0x0c 0x01 0x03 
Value of expected_rxseq : 0
BCSP_GET_SEQ(bcsp) : 0

process_event (4):
0x01 0x1a 0x0c 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: WRITE_SCAN_ENABLE
HCI: hci_write_pagescan_activity

send_cmd_queue:  (8):
0x01 0x1c 0x0c 0x04 0x00 0x08 0x12 0x00 
Value of expected_rxseq : 1
BCSP_GET_SEQ(bcsp) : 1

process_event (4):
0x01 0x1c 0x0c 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: WRITE_PAGESCAN_ACTIVITY
HCI: hci_set_event_filter

send_cmd_queue:  (7):
0x01 0x05 0x0c 0x03 0x00 0x73 0x60 
Value of expected_rxseq : 2
BCSP_GET_SEQ(bcsp) : 2

process_event (4):
0x01 0x05 0x0c 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: SET_EVENT_FILTER
Value of expected_rxseq : 3
BCSP_GET_SEQ(bcsp) : 3
HCI: release_cmd_timer
BT SYS: hci_receive_hq: Unknown message type

hci_receive_hq (24):
0x02 0x00 0x0c 0x00 0x8d 0x1e 0x00 0x10 0x00 0x00 0x1c 0x00 0x1e 0x00 0xd1 0x74 
0x01 0x00 0x3d 0x97 0x00 0xb3 0x24 0xb7 
Value of expected_rxseq : 4
BCSP_GET_SEQ(bcsp) : 4

process_event (1):
0x1c 
BT SYS: ERROR: process_event: A hardware error with error code 0x1C occurred.
BT SYS: ERROR: process_event: Please refer to your Bluetooth module's manual.


---- End of first logs ----








---- Start of second logs, with function hci_receive_bcsp modified for big endian ----


BT SYS: Setting BT driver to use serial tty
BT SYS: Initialising Bluetooth Stack
BT SYS: Current HW: CSR
BT SYS: Initialising BTMEM [2500 bytes]
BT SYS: Initializing BCSP
BT SYS: BCSP initialized and syncronized
HCI: csr_waitcmdnum
Value of expected_rxseq : 0
BCSP_GET_SEQ(bcsp) : 0

process_event (4):
0x00 0x01 0x00 0x00 
HCI: release_cmd_timer
HCI: process_event: COMMAND_STATUS
BT SYS: Initialising HCI
BT SYS: HCI emulator off
BT SYS: Initialising HCI inbuffers [800]
BT SYS: Reading buffer sizes in HW module
HCI: hci_read_buffer_size

send_cmd_queue:  (4):
0x01 0x05 0x10 0x00 
Value of expected_rxseq : 1
BCSP_GET_SEQ(bcsp) : 1

process_event (11):
0x01 0x05 0x10 0x00 0xc0 0x00 0x40 0x08 0x00 0x08 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: READ_BUFFER_SIZE

HW module contains...
8 ACL buffers at 192 bytes
8 SCO buffers at 64 bytes

BT SYS: Reading firmware info in HW module
HCI: hci_read_firmware_rev_info [CSR] BuildID/ChipVer/ChipRev

send_cmd_queue:  (27):
0x01 0x00 0xfc 0x17 0xc2 0x00 0x00 0x0b 0x00 0x00 0x00 0x19 0x28 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
Value of expected_rxseq : 2
BCSP_GET_SEQ(bcsp) : 2
HCI: release_cmd_timer

send_cmd_queue:  (27):
0x01 0x00 0xfc 0x17 0xc2 0x00 0x00 0x0b 0x00 0x01 0x00 0x1a 0x28 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
Value of expected_rxseq : 3
BCSP_GET_SEQ(bcsp) : 3
HCI: release_cmd_timer

send_cmd_queue:  (27):
0x01 0x00 0xfc 0x17 0xc2 0x00 0x00 0x0b 0x00 0x02 0x00 0x1b 0x28 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
Value of expected_rxseq : 4
BCSP_GET_SEQ(bcsp) : 4
HCI: release_cmd_timer
BT SYS: Host flow control not enabled
BT SYS: M/S switch disabled
BT SYS: Force M/S switch set to 0
BT SYS: Initialising L2CAP
HCI: hci_read_local_bd

send_cmd_queue:  (4):
0x01 0x09 0x10 0x00 
Value of expected_rxseq : 5
BCSP_GET_SEQ(bcsp) : 5

process_event (10):
0x01 0x09 0x10 0x00 0x83 0x12 0x00 0x61 0x07 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: READ_BD_ADDR

process_return_param: READ_BD_ADDR :  (6):
0x83 0x12 0x00 0x61 0x07 0x00 
BT SYS: Local bd [00:07:61:00:12:83]
BT SYS: Initialising RFCOMM
BT SYS: Initialising SDP
BT SYS: Init SDP as server
BT SYS: Initialising TCS
BT SYS: Initialising TEST
HCI: hci_write_class_of_device: Service class 0x10, major:0x3, minor:0x0
HCI: hci_write_class_of_device: 2:3:0

send_cmd_queue:  (7):
0x01 0x24 0x0c 0x03 0x00 0x03 0x02 
Value of expected_rxseq : 6
BCSP_GET_SEQ(bcsp) : 6

process_event (4):
0x01 0x24 0x0c 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: WRITE_CLASS_OF_DEVICE
HCI: hci_change_local_name: New name: Remora

send_cmd_queue:  (252):
0x01 0x13 0x0c 0xf8 0x52 0x65 0x6d 0x6f 0x72 0x61 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 
Value of expected_rxseq : 7
BCSP_GET_SEQ(bcsp) : 7

process_event (4):
0x01 0x13 0x0c 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: CHANGE_LOCAL_NAME
HCI: hci_write_scan_enable: enable 3

send_cmd_queue:  (5):
0x01 0x1a 0x0c 0x01 0x03 
Value of expected_rxseq : 0
BCSP_GET_SEQ(bcsp) : 0

process_event (4):
0x01 0x1a 0x0c 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: WRITE_SCAN_ENABLE
HCI: hci_write_pagescan_activity

send_cmd_queue:  (8):
0x01 0x1c 0x0c 0x04 0x00 0x08 0x12 0x00 
Value of expected_rxseq : 1
BCSP_GET_SEQ(bcsp) : 1

process_event (4):
0x01 0x1c 0x0c 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: WRITE_PAGESCAN_ACTIVITY
HCI: hci_set_event_filter

send_cmd_queue:  (7):
0x01 0x05 0x0c 0x03 0x00 0x73 0x60 
Value of expected_rxseq : 2
BCSP_GET_SEQ(bcsp) : 2

process_event (4):
0x01 0x05 0x0c 0x00 
HCI: process_event: COMMAND_COMPLETE
HCI: release_cmd_timer
HCI: process_return_param: SET_EVENT_FILTER
HCI: hci_set_baudrate [CSR] (57600 baud)
Value of expected_rxseq : 3
BCSP_GET_SEQ(bcsp) : 0
hci_ctrl.hc_buf.acl_num = 8
Value of buf_count() : 0
seq out-of-order [exp:3, got:0], send ack

# Value of expected_rxseq : 3
BCSP_GET_SEQ(bcsp) : 0
hci_ctrl.hc_buf.acl_num = 8
Value of buf_count() : 0
seq out-of-order [exp:3, got:0], send ack

--- End of second logs ---


-- 
Alain Paschoud                      SMARTDATA SA
alain.paschoud@xxxxxxx.ch         PSE-A
http://www.smartdata.ch             1015 Lausanne
Phone +41-21-693'84'98              
Fax   +41-27-693'84'91              
-
To unsubscribe from this list: send the line "unsubscribe bluetooth-dev" in
the body of a message to majordomo@xxxxxxx.com