obexftp -l fails, return code 81 - android

I am currently attempting to use obex tools to browse (and later mount) the file system of an Android device (7.1.1). When I try to list using obexftp -l, it simply returns nothing. I have tried almost every possible combination of file parameters after -l, but still get the same error. My end goal is to use obexfs to mount, but feel this is an intermediate stepping stone. Details below.
uname -r: 3.14.2-xilinx
bluetoothd -v: 4.101
bluetoothctl -v 5.47
lsusb: Bus 001 Device 004: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0
hcitool dev: hci0 5C:F3:70:82:XX:XX
hciconfig -a:
hci0: Type: BR/EDR Bus: USB
BD Address: 5C:F3:70:82:XX:XX ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN ISCAN
RX bytes:13146 acl:211 sco:0 events:382 errors:0
TX bytes:6265 acl:219 sco:0 commands:149 errors:0
Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH SNIFF
Link mode: SLAVE ACCEPT
Name: '312_BT-0'
Class: 0x000100
Service Classes: Unspecified
Device Class: Computer, Uncategorized
HCI Version: 4.0 (0x6) Revision: 0x1000
LMP Version: 4.0 (0x6) Subversion: 0x220e
Manufacturer: Broadcom Corporation (15)
Succesful file push from Linux device to Android device:
obexftp -b D4:63:C6:XX:XX:XX -B 6 -U none -p /home/root/test.txt
Suppressing FBS.
Connecting..\done
Sending "/home/root/test.txt".../done
Disconnecting..-done
Attempting to list file structure on Android device:
obexftp -b D4:63:C6:XX:XX:XX -B 6 -U none -l
Suppressing FBS.
Connecting..\done
Receiving "(null)"...|failed: (null)
The operation failed with return code 81
Disconnecting../done
Output of btmon when attempting above obexftp -l command:
= New Index: 5C:F3:70:82:XX:XX (Primary,USB,hci0) [hci0] 0.316536
< HCI Command: Create Connection (0x01|0x0005) plen 13 #1 [hci0] 3.563946
Address: D4:63:C6:XX:XX:XX (OUI D4-63-C6)
Packet type: 0xcc18
DM1 may be used
DH1 may be used
DM3 may be used
DH3 may be used
DM5 may be used
DH5 may be used
Page scan repetition mode: R2 (0x02)
Page scan mode: Mandatory (0x00)
Clock offset: 0x0000
Role switch: Allow slave (0x01)
> HCI Event: Command Status (0x0f) plen 4 #2 [hci0] 3.565628
Create Connection (0x01|0x0005) ncmd 1
Status: Success (0x00)
> HCI Event: Role Change (0x12) plen 8 #3 [hci0] 5.392513
Status: Success (0x00)
Address: D4:63:C6:XX:XX:XX (OUI D4-63-C6)
Role: Slave (0x01)
> HCI Event: Connect Complete (0x03) plen 11 #4 [hci0] 5.414518
Status: Success (0x00)
Handle: 11
Address: D4:63:C6:XX:XX:XX (OUI D4-63-C6)
Link type: ACL (0x01)
Encryption: Disabled (0x00)
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2 #5 [hci0] 5.414709
Handle: 11
> HCI Event: Command Status (0x0f) plen 4 #6 [hci0] 5.415523
Read Remote Supported Features (0x01|0x001b) ncmd 1
Status: Success (0x00)
> HCI Event: Max Slots Change (0x1b) plen 3 #7 [hci0] 5.425523
Handle: 11
Max slots: 5
> HCI Event: Link Supervision Timeout Changed (0x38) plen 4 #8 [hci0] 5.429522
Handle: 11
Timeout: 5000.000 msec (0x1f40)
> ACL Data RX: Handle 11 flags 0x02 dlen 10 #9 [hci0] 5.432524
L2CAP: Information Request (0x0a) ident 2 len 2
Type: Extended features supported (0x0002)
< ACL Data TX: Handle 11 flags 0x00 dlen 16 #10 [hci0] 5.432580
L2CAP: Information Response (0x0b) ident 2 len 8
Type: Extended features supported (0x0002)
Result: Success (0x0000)
Features: 0x000002b8
Enhanced Retransmission Mode
Streaming Mode
FCS Option
Fixed Channels
Unicast Connectionless Data Reception
> HCI Event: Read Remote Supported Features (0x0b) plen 11 #11 [hci0] 5.438528
Status: Success (0x00)
Handle: 11
Features: 0xff 0xfe 0x8f 0xfe 0xd8 0x3f 0x5b 0x87
3 slot packets
5 slot packets
Encryption
Slot offset
Timing accuracy
Role switch
Hold mode
Sniff mode
Power control requests
Channel quality driven data rate (CQDDR)
SCO link
HV2 packets
HV3 packets
u-law log synchronous data
A-law log synchronous data
CVSD synchronous data
Paging parameter negotiation
Power control
Transparent synchronous data
Broadcast Encryption
Enhanced Data Rate ACL 2 Mbps mode
Enhanced Data Rate ACL 3 Mbps mode
Enhanced inquiry scan
Interlaced inquiry scan
Interlaced page scan
RSSI with inquiry results
Extended SCO link (EV3 packets)
AFH capable slave
AFH classification slave
LE Supported (Controller)
3-slot Enhanced Data Rate ACL packets
5-slot Enhanced Data Rate ACL packets
Sniff subrating
Pause encryption
AFH capable master
AFH classification master
Enhanced Data Rate eSCO 2 Mbps mode
Extended Inquiry Response
Simultaneous LE and BR/EDR (Controller)
Secure Simple Pairing
Encapsulated PDU
Non-flushable Packet Boundary Flag
Link Supervision Timeout Changed Event
Inquiry TX Power Level
Enhanced Power Control
Extended features
< HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3 #12 [hci0] 5.438569
Handle: 11
Page: 1
> ACL Data RX: Handle 11 flags 0x02 dlen 10 #13 [hci0] 5.438782
L2CAP: Information Request (0x0a) ident 3 len 2
Type: Fixed channels supported (0x0003)
< ACL Data TX: Handle 11 flags 0x00 dlen 20 #14 [hci0] 5.438818
L2CAP: Information Response (0x0b) ident 3 len 12
Type: Fixed channels supported (0x0003)
Result: Success (0x0000)
Channels: 0x0000000000000006
L2CAP Signaling (BR/EDR)
Connectionless reception
> HCI Event: Command Status (0x0f) plen 4 #15 [hci0] 5.440527
Read Remote Extended Features (0x01|0x001c) ncmd 1
Status: Success (0x00)
> HCI Event: Number of Completed Packets (0x13) plen 5 #16 [hci0] 5.443529
Num handles: 1
Handle: 11
Count: 2
> HCI Event: Read Remote Extended Features (0x23) plen 13 #17 [hci0] 5.444528
Status: Success (0x00)
Handle: 11
Page: 1/1
Features: 0x0f 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Secure Simple Pairing (Host Support)
LE Supported (Host)
Simultaneous LE and BR/EDR (Host)
Secure Connections (Host Support)
< HCI Command: Remote Name Request (0x01|0x0019) plen 10 #18 [hci0] 5.444573
Address: D4:63:C6:XX:XX:XX (OUI D4-63-C6)
Page scan repetition mode: R2 (0x02)
Page scan mode: Mandatory (0x00)
Clock offset: 0x0000
> HCI Event: Command Status (0x0f) plen 4 #19 [hci0] 5.445529
Remote Name Request (0x01|0x0019) ncmd 1
Status: Success (0x00)
> HCI Event: Remote Name Req Complete (0x07) plen 255 #20 [hci0] 5.465535
Status: Success (0x00)
Address: D4:63:C6:XX:XX:XX (OUI D4-63-C6)
Name: Moto E (4)
< HCI Command: Authentication Requested (0x01|0x0011) plen 2 #21 [hci0] 5.465591
Handle: 11
Device Connected: D4:63:C6:XX:XX:XX (0) flags 0x0000
0b 09 4d 6f 74 6f 20 45 20 28 34 29 04 0d 0c 02 ..Moto E (4)....
5a Z
> HCI Event: Command Status (0x0f) plen 4 #22 [hci0] 5.466545
Authentication Requested (0x01|0x0011) ncmd 1
Status: Success (0x00)
> HCI Event: Link Key Request (0x17) plen 6 #23 [hci0] 5.467541
Address: D4:63:C6:XX:XX:XX (OUI D4-63-C6)
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22 #24 [hci0] 5.467588
Address: D4:63:C6:XX:XX:XX (OUI D4-63-C6)
Link key: b0912a0c42db7615860023aa911d552b
> HCI Event: Command Complete (0x0e) plen 10 #25 [hci0] 5.470540
Link Key Request Reply (0x01|0x000b) ncmd 1
Status: Success (0x00)
Address: D4:63:C6:XX:XX:XX (OUI D4-63-C6)
> HCI Event: Auth Complete (0x06) plen 3 #26 [hci0] 5.489555
Status: Success (0x00)
Handle: 11
< HCI Command: Set Connection Encryption (0x01|0x0013) plen 3 #27 [hci0] 5.489604
Handle: 11
Encryption: Enabled (0x01)
> HCI Event: Command Status (0x0f) plen 4 #28 [hci0] 5.490550
Set Connection Encryption (0x01|0x0013) ncmd 1
Status: Success (0x00)
> HCI Event: Encryption Change (0x08) plen 4 #29 [hci0] 5.532580
Status: Success (0x00)
Handle: 11
Encryption: Enabled with E0 (0x01)
< ACL Data TX: Handle 11 flags 0x00 dlen 10 #30 [hci0] 5.532645
L2CAP: Information Request (0x0a) ident 1 len 2
Type: Extended features supported (0x0002)
> ACL Data RX: Handle 11 flags 0x02 dlen 16 #31 [hci0] 5.562719
L2CAP: Information Response (0x0b) ident 1 len 8
Type: Extended features supported (0x0002)
Result: Success (0x0000)
Features: 0x000000b8
Enhanced Retransmission Mode
Streaming Mode
FCS Option
Fixed Channels
< ACL Data TX: Handle 11 flags 0x00 dlen 10 #32 [hci0] 5.562780
L2CAP: Information Request (0x0a) ident 2 len 2
Type: Fixed channels supported (0x0003)
> HCI Event: Number of Completed Packets (0x13) plen 5 #33 [hci0] 5.565591
Num handles: 1
Handle: 11
Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 20 #34 [hci0] 5.566462
L2CAP: Information Response (0x0b) ident 2 len 12
Type: Fixed channels supported (0x0003)
Result: Success (0x0000)
Channels: 0x0000000000000082
L2CAP Signaling (BR/EDR)
Security Manager (BR/EDR)
< ACL Data TX: Handle 11 flags 0x00 dlen 12 #35 [hci0] 5.566511
L2CAP: Connection Request (0x02) ident 3 len 4
PSM: 3 (0x0003)
Source CID: 64
> ACL Data RX: Handle 11 flags 0x02 dlen 16 #36 [hci0] 5.570089
L2CAP: Connection Response (0x03) ident 3 len 8
Destination CID: 67
Source CID: 64
Result: Connection successful (0x0000)
Status: No further information available (0x0000)
< ACL Data TX: Handle 11 flags 0x00 dlen 27 #37 [hci0] 5.570138
L2CAP: Configure Request (0x04) ident 4 len 19
Destination CID: 67
Flags: 0x0000
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 1013
Option: Retransmission and Flow Control (0x04) [mandatory]
Mode: Basic (0x00)
TX window size: 0
Max transmit: 0
Retransmission timeout: 0
Monitor timeout: 0
Maximum PDU size: 0
> ACL Data RX: Handle 11 flags 0x02 dlen 16 #38 [hci0] 5.571470
L2CAP: Configure Request (0x04) ident 4 len 8
Destination CID: 64
Flags: 0x0000
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 1691
< ACL Data TX: Handle 11 flags 0x00 dlen 18 #39 [hci0] 5.571521
L2CAP: Configure Response (0x05) ident 4 len 10
Source CID: 67
Flags: 0x0000
Result: Success (0x0000)
Option: Maximum Transmission Unit (0x01) [mandatory]
MTU: 1691
> HCI Event: Number of Completed Packets (0x13) plen 5 #40 [hci0] 5.573594
Num handles: 1
Handle: 11
Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 14 #41 [hci0] 5.573967
L2CAP: Configure Response (0x05) ident 4 len 6
Source CID: 64
Flags: 0x0000
Result: Success (0x0000)
< ACL Data TX: Handle 11 flags 0x00 dlen 8 #42 [hci0] 5.574064
Channel: 67 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Set Async Balance Mode (SABM) (0x2f)
Address: 0x03 cr 1 dlci 0x00
Control: 0x3f poll/final 1
Length: 0
FCS: 0x1c
> HCI Event: Number of Completed Packets (0x13) plen 5 #43 [hci0] 5.577595
Num handles: 1
Handle: 11
Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 8 #44 [hci0] 5.577612
Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Ack (UA) (0x63)
Address: 0x03 cr 1 dlci 0x00
Control: 0x73 poll/final 1
Length: 0
FCS: 0xd7
< ACL Data TX: Handle 11 flags 0x00 dlen 18 #45 [hci0] 5.577681
Channel: 67 len 14 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x03 cr 1 dlci 0x00
Control: 0xef poll/final 0
Length: 10
FCS: 0x70
MCC Message type: DLC Parameter Negotiation CMD (0x20)
Length: 8
dlci 12 frame_type 0 credit_flow 15 pri 7
ack_timer 0 frame_size 1008 max_retrans 0 credits 7
> ACL Data RX: Handle 11 flags 0x02 dlen 18 #46 [hci0] 5.581473
Channel: 64 len 14 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x01 cr 0 dlci 0x00
Control: 0xef poll/final 0
Length: 10
FCS: 0xaa
MCC Message type: DLC Parameter Negotiation RSP (0x20)
Length: 8
dlci 12 frame_type 0 credit_flow 14 pri 7
ack_timer 0 frame_size 990 max_retrans 0 credits 7
< ACL Data TX: Handle 11 flags 0x00 dlen 8 #47 [hci0] 5.581541
Channel: 67 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Set Async Balance Mode (SABM) (0x2f)
Address: 0x33 cr 1 dlci 0x0c
Control: 0x3f poll/final 1
Length: 0
FCS: 0x43
> HCI Event: Number of Completed Packets (0x13) plen 5 #48 [hci0] 5.584597
Num handles: 1
Handle: 11
Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 8 #49 [hci0] 5.585096
Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Ack (UA) (0x63)
Address: 0x33 cr 1 dlci 0x0c
Control: 0x73 poll/final 1
Length: 0
FCS: 0x88
< ACL Data TX: Handle 11 flags 0x00 dlen 12 #50 [hci0] 5.585552
Channel: 67 len 8 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x03 cr 1 dlci 0x00
Control: 0xef poll/final 0
Length: 4
FCS: 0x70
MCC Message type: Modem Status Command CMD (0x38)
Length: 2
dlci 12
fc 0 rtc 1 rtr 1 ic 0 dv 1
> ACL Data RX: Handle 11 flags 0x02 dlen 12 #51 [hci0] 5.591479
Channel: 64 len 8 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x01 cr 0 dlci 0x00
Control: 0xef poll/final 0
Length: 4
FCS: 0xaa
MCC Message type: Modem Status Command RSP (0x38)
Length: 2
dlci 12
fc 0 rtc 1 rtr 1 ic 0 dv 1
> ACL Data RX: Handle 11 flags 0x02 dlen 12 #52 [hci0] 5.592601
Channel: 64 len 8 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x01 cr 0 dlci 0x00
Control: 0xef poll/final 0
Length: 4
FCS: 0xaa
MCC Message type: Modem Status Command CMD (0x38)
Length: 2
dlci 12
fc 0 rtc 1 rtr 1 ic 0 dv 1
< ACL Data TX: Handle 11 flags 0x00 dlen 12 #53 [hci0] 5.592664
Channel: 67 len 8 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x03 cr 1 dlci 0x00
Control: 0xef poll/final 0
Length: 4
FCS: 0x70
MCC Message type: Modem Status Command RSP (0x38)
Length: 2
dlci 12
fc 0 rtc 1 rtr 1 ic 0 dv 1
< ACL Data TX: Handle 11 flags 0x00 dlen 9 #54 [hci0] 5.592678
Channel: 67 len 5 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x33 cr 1 dlci 0x0c
Control: 0xff poll/final 1
Length: 0
FCS: 0x53
Credits: 33
53 S
< ACL Data TX: Handle 11 flags 0x00 dlen 15 #55 [hci0] 5.592688
Channel: 67 len 11 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x33 cr 1 dlci 0x0c
Control: 0xef poll/final 0
Length: 7
FCS: 0x4f
80 00 07 10 00 04 00 4f .......O
> HCI Event: Number of Completed Packets (0x13) plen 5 #56 [hci0] 5.595604
Num handles: 1
Handle: 11
Count: 2
> HCI Event: Number of Completed Packets (0x13) plen 5 #57 [hci0] 5.598602
Num handles: 1
Handle: 11
Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 21 #58 [hci0] 5.601479
Channel: 64 len 17 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x31 cr 0 dlci 0x0c
Control: 0xff poll/final 1
Length: 12
FCS: 0x89
Credits: 4
a0 00 0c 10 00 04 00 cb 00 00 00 01 89 .............
< ACL Data TX: Handle 11 flags 0x00 dlen 41 #59 [hci0] 5.601739
Channel: 67 len 37 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x33 cr 1 dlci 0x0c
Control: 0xef poll/final 0
Length: 33
FCS: 0x4f
83 00 21 cb 00 00 00 01 42 00 19 78 2d 6f 62 65 ..!.....B..x-obe
78 2f 66 6f 6c 64 65 72 2d 6c 69 73 74 69 6e 67 x/folder-listing
00 4f .O
> ACL Data RX: Handle 11 flags 0x02 dlen 17 #60 [hci0] 5.612611
Channel: 64 len 13 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x31 cr 0 dlci 0x0c
Control: 0xff poll/final 1
Length: 8
FCS: 0x89
Credits: 1
d1 00 08 cb 00 00 00 01 89 .........
< ACL Data TX: Handle 11 flags 0x00 dlen 16 #61 [hci0] 5.613075
Channel: 67 len 12 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x33 cr 1 dlci 0x0c
Control: 0xef poll/final 0
Length: 8
FCS: 0x4f
81 00 08 cb 00 00 00 01 4f ........O
> HCI Event: Number of Completed Packets (0x13) plen 5 #62 [hci0] 5.618623
Num handles: 1
Handle: 11
Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 17 #63 [hci0] 5.623869
Channel: 64 len 13 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
Address: 0x31 cr 0 dlci 0x0c
Control: 0xff poll/final 1
Length: 8
FCS: 0x89
Credits: 1
a0 00 08 cb 00 00 00 01 89 .........
< ACL Data TX: Handle 11 flags 0x00 dlen 8 #64 [hci0] 5.624057
Channel: 67 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Disconnect (DISC) (0x43)
Address: 0x33 cr 1 dlci 0x0c
Control: 0x53 poll/final 1
Length: 0
FCS: 0xa2
> ACL Data RX: Handle 11 flags 0x02 dlen 8 #65 [hci0] 5.628872
Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Ack (UA) (0x63)
Address: 0x33 cr 1 dlci 0x0c
Control: 0x73 poll/final 1
Length: 0
FCS: 0x88
< ACL Data TX: Handle 11 flags 0x00 dlen 8 #66 [hci0] 5.628967
Channel: 67 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Disconnect (DISC) (0x43)
Address: 0x03 cr 1 dlci 0x00
Control: 0x53 poll/final 1
Length: 0
FCS: 0xfd
> HCI Event: Number of Completed Packets (0x13) plen 5 #67 [hci0] 5.632625
Num handles: 1
Handle: 11
Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 8 #68 [hci0] 5.632644
Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Ack (UA) (0x63)
Address: 0x03 cr 1 dlci 0x00
Control: 0x73 poll/final 1
Length: 0
FCS: 0xd7
< ACL Data TX: Handle 11 flags 0x00 dlen 12 #69 [hci0] 5.632733
L2CAP: Disconnection Request (0x06) ident 5 len 4
Destination CID: 67
Source CID: 64
> ACL Data RX: Handle 11 flags 0x02 dlen 12 #70 [hci0] 5.637623
L2CAP: Disconnection Response (0x07) ident 5 len 4
Destination CID: 67
Source CID: 64
> HCI Event: Number of Completed Packets (0x13) plen 5 #71 [hci0] 5.863739
Num handles: 1
Handle: 11
Count: 1
< HCI Command: Disconnect (0x01|0x0006) plen 3 #72 [hci0] 7.631380
Handle: 11
Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4 #73 [hci0] 7.632590
Disconnect (0x01|0x0006) ncmd 1
Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4 #74 [hci0] 7.727640
Status: Success (0x00)
Handle: 11
Reason: Connection Terminated By Local Host (0x16)
Device Disconnected: D4:63:C6:XX:XX:XX (0) reason 2

After continuing to try many different things, I realized that is was more than likely the Android device having the issue. The solution is that the Android device needs to have an FTP Service running in order to utilize obexftp -l or obexfs. I achieved this by installing ES File Explorer on the Android device and selecting 'bluetooth' under the 'Network' tab. This opens an Obex FTP path on Bluetooth channel 20. The code below now functions; as well as obexfs.
obexftp -b D4:63:C6:XX:XX:XX -B 20 -U none -l

Related

Android Bluetooth device stuck in connect/disconnect loop with Linux Bluez Peripheral

For a BLE project I have been working on, I have created a smartphone application which serves as central, and a program in Linux, that serves as peripheral. After manually disconnecting via the phone, the program works as intended. But after disconnecting via the peripheral, the connection gets stuck in connect/disconnect loop.
I'm using "JustWorks" in bluetooth, which doesn't require any bonding/pairing.
The smartphone application is made in Flutter, and uses the flutter_reactive_ble library from Hue. The Linux program is written in Python, and uses the Bluezero package, but for disconnecting, I'm using:
subprocess.run("bluetoothctl -- disconnect", shell=True)
The terminal that is running the peripheral looks like this:
Attempting to disconnect from 58:93:C0:B5:9B:D7
Successful disconnected
[CHG] Device 58:93:C0:B5:9B:D7 Connected: no
Attempting to disconnect from 58:93:C0:B5:9B:D7
Successful disconnected
Attempting to disconnect from 58:93:C0:B5:9B:D7
Successful disconnected
The bluetoothctl terminal looks like this:
[CHG] Device 6E:4C:38:CB:4D:A9 Connected: no
[CHG] Device 6E:4C:38:CB:4D:A9 Connected: yes
[CHG] Device 6E:4C:38:CB:4D:A9 Connected: no
[CHG] Device 6E:4C:38:CB:4D:A9 Connected: yes
[CHG] Device 6E:4C:38:CB:4D:A9 Connected: no
[CHG] Device 6E:4C:38:CB:4D:A9 Connected: yes
This is the btmon output: From start to end: Received data -> disconnected from peripheral -> stuck in connect/disconnect loop.
> HCI Event: LE Meta Event (0x3e) plen 10 #72 [hci0] 4.765604
LE Connection Update Complete (0x03)
Status: Success (0x00)
Handle: 24
Connection interval: 45.00 msec (0x0024)
Connection latency: 0 (0x0000)
Supervision timeout: 5000 msec (0x01f4)
> ACL Data RX: Handle 24 flags 0x02 dlen 27 #73 [hci0] 4.855361
> ACL Data RX: Handle 24 flags 0x01 dlen 27 #74 [hci0] 4.856590
> ACL Data RX: Handle 24 flags 0x01 dlen 81 #75 [hci0] 4.857340
ATT: Write Command (0x52) len 130
Handle: 0x0026
Data: 6c69664638704647574134704656625275514a6d727053547062486a754d4c527758674f545733496d4e566630506d385542776c7a446155482b774f506f6a6330335345796c69695438494477554e477664617431424a3373496b352f58476d507a5937676a42707462436e4574392f5858702b79426b4e77796e43694c7242
> HCI Event: LE Meta Event (0x3e) plen 11 #76 [hci0] 4.857646
LE Data Length Change (0x07)
Handle: 24
Max TX octets: 251
Max TX time: 2120
Max RX octets: 250
Max RX time: 2120
# MGMT Command: Disconnect (0x0014) plen 7 {0x0001} [hci0] 6.819215
LE Address: 48:AD:99:8B:C5:3D (Resolvable)
< HCI Command: Disconnect (0x01|0x0006) plen 3 #77 [hci0] 6.819411
Handle: 24
Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4 #78 [hci0] 6.823217
Disconnect (0x01|0x0006) ncmd 2
Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4 #79 [hci0] 6.881799
Status: Success (0x00)
Handle: 24
Reason: Connection Terminated By Local Host (0x16)
# MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 6.882315
Disconnect (0x0014) plen 7
Status: Success (0x00)
LE Address: 48:AD:99:8B:C5:3D (Resolvable)
< HCI Command: LE Set Extended Adve.. (0x08|0x0039) plen 6 #80 [hci0] 6.907442
Extended advertising: Disabled (0x00)
Number of sets: 1 (0x01)
Entry 0
Handle: 0x01
Duration: 0 ms (0x00)
Max ext adv events: 0
> HCI Event: Command Complete (0x0e) plen 4 #81 [hci0] 6.911608
LE Set Extended Advertising Enable (0x08|0x0039) ncmd 2
Status: Success (0x00)
< HCI Command: LE Set Extended Adv.. (0x08|0x0036) plen 25 #82 [hci0] 6.911986
Handle: 0x01
Properties: 0x0013
Connectable
Scannable
Use legacy advertising PDUs: ADV_IND
Min advertising interval: 37.500 msec (0x003c)
Max advertising interval: 37.500 msec (0x003c)
Channel map: 37, 38, 39 (0x07)
Own address type: Public (0x00)
Peer address type: Public (0x00)
Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
TX power: 0 dbm (0x00)
Primary PHY: LE 1M (0x01)
Secondary max skip: 0x00
Secondary PHY: LE 1M (0x01)
SID: 0x00
Scan request notifications: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 5 #83 [hci0] 6.913620
LE Set Extended Advertising Parameters (0x08|0x0036) ncmd 2
Status: Success (0x00)
TX power (selected): 0 dbm (0x00)
< HCI Command: LE Set Extended Adve.. (0x08|0x0039) plen 6 #84 [hci0] 6.913983
Extended advertising: Enabled (0x01)
Number of sets: 1 (0x01)
Entry 0
Handle: 0x01
Duration: 0 ms (0x00)
Max ext adv events: 0
> HCI Event: Command Complete (0x0e) plen 4 #85 [hci0] 6.918517
LE Set Extended Advertising Enable (0x08|0x0039) ncmd 2
Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19 #86 [hci0] 7.793289
LE Connection Complete (0x01)
Status: Success (0x00)
Handle: 24
Role: Peripheral (0x01)
Peer address type: Random (0x01)
Peer address: 48:AD:99:8B:C5:3D (Resolvable)
Connection interval: 45.00 msec (0x0024)
Connection latency: 0 (0x0000)
Supervision timeout: 5000 msec (0x01f4)
Central clock accuracy: 0x01
# MGMT Event: Device Connected (0x000b) plen 13 {0x0001} [hci0] 7.793976
LE Address: 48:AD:99:8B:C5:3D (Resolvable)
Flags: 0x00000000
Data length: 0
< HCI Command: LE Read Remote Used... (0x08|0x0016) plen 2 #87 [hci0] 7.794074
Handle: 24
> HCI Event: LE Meta Event (0x3e) plen 6 #88 [hci0] 7.795376
LE Advertising Set Terminated (0x12)
Status: Success (0x00)
Handle: 1
Connection handle: 24
Number of completed extended advertising events: 20
> HCI Event: Command Status (0x0f) plen 4 #89 [hci0] 7.797118
LE Read Remote Used Features (0x08|0x0016) ncmd 2
Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 4 #90 [hci0] 7.827428
LE Channel Selection Algorithm (0x14)
Handle: 24
Algorithm: #2 (0x01)
> HCI Event: LE Meta Event (0x3e) plen 12 #91 [hci0] 7.873271
LE Read Remote Used Features (0x04)
Status: Success (0x00)
Handle: 24
Features: 0xbd 0x7f 0x00 0x37 0x01 0x00 0x00 0x00
LE Encryption
Extended Reject Indication
Peripheral-initiated Features Exchange
LE Ping
LE Data Packet Length Extension
Extended Scanner Filter Policies
LE 2M PHY
Stable Modulation Index - Transmitter
Stable Modulation Index - Receiver
LE Coded PHY
LE Extended Advertising
LE Periodic Advertising
Channel Selection Algorithm #2
Periodic Advertising Sync Transfer - Sender
Periodic Advertising Sync Transfer - Recipient
Sleep Clock Accuracy Updates
Connected Isochronous Stream - Central
Connected Isochronous Stream - Peripheral
Isochronous Channels (Host Support)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #92 [hci0] 8.006833
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 3 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 67
Source CID: 80
Source CID: 72
Source CID: 73
Source CID: 74
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #93 [hci0] 8.011070
LE L2CAP: Command Reject (0x01) ident 3 len 2
Reason: Command not understood (0x0000)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #94 [hci0] 8.011537
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 4 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 67
Source CID: 80
Source CID: 72
Source CID: 73
Source CID: 74
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #95 [hci0] 8.011863
LE L2CAP: Command Reject (0x01) ident 4 len 2
Reason: Command not understood (0x0000)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #96 [hci0] 8.013806
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 5 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 67
Source CID: 80
Source CID: 72
Source CID: 73
Source CID: 74
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #97 [hci0] 8.014120
LE L2CAP: Command Reject (0x01) ident 5 len 2
Reason: Command not understood (0x0000)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #98 [hci0] 8.015700
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 6 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 67
Source CID: 80
Source CID: 72
Source CID: 73
Source CID: 74
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #99 [hci0] 8.016011
LE L2CAP: Command Reject (0x01) ident 6 len 2
Reason: Command not understood (0x0000)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #100 [hci0] 8.017572
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 7 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 67
Source CID: 80
Source CID: 72
Source CID: 73
Source CID: 74
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #101 [hci0] 8.017884
LE L2CAP: Command Reject (0x01) ident 7 len 2
Reason: Command not understood (0x0000)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #102 [hci0] 8.019854
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 8 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 67
Source CID: 80
Source CID: 72
Source CID: 73
Source CID: 74
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #103 [hci0] 8.020183
LE L2CAP: Command Reject (0x01) ident 8 len 2
Reason: Command not understood (0x0000)
> HCI Event: Number of Completed Packets (0x13) plen 5 #104 [hci0] 8.055702
Num handles: 1
Handle: 24
Count: 1
> HCI Event: LE Meta Event (0x3e) plen 11 #105 [hci0] 8.059275
LE Data Length Change (0x07)
Handle: 24
Max TX octets: 251
Max TX time: 2120
Max RX octets: 27
Max RX time: 328
> HCI Event: Number of Completed Packets (0x13) plen 5 #106 [hci0] 8.063411
Num handles: 1
Handle: 24
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 #107 [hci0] 8.067380
Num handles: 1
Handle: 24
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 #108 [hci0] 8.070316
Num handles: 1
Handle: 24
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 #109 [hci0] 8.072300
Num handles: 1
Handle: 24
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 #110 [hci0] 8.099836
Num handles: 1
Handle: 24
Count: 1
# MGMT Command: Disconnect (0x0014) plen 7 {0x0001} [hci0] 10.834677
LE Address: 48:AD:99:8B:C5:3D (Resolvable)
< HCI Command: Disconnect (0x01|0x0006) plen 3 #111 [hci0] 10.836267
Handle: 24
Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4 #112 [hci0] 10.840869
Disconnect (0x01|0x0006) ncmd 2
Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4 #113 [hci0] 10.889096
Status: Success (0x00)
Handle: 24
Reason: Connection Terminated By Local Host (0x16)
# MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 10.889891
Disconnect (0x0014) plen 7
Status: Success (0x00)
LE Address: 48:AD:99:8B:C5:3D (Resolvable)
< HCI Command: LE Set Extended Ad.. (0x08|0x0039) plen 6 #114 [hci0] 10.919524
Extended advertising: Disabled (0x00)
Number of sets: 1 (0x01)
Entry 0
Handle: 0x01
Duration: 0 ms (0x00)
Max ext adv events: 0
> HCI Event: Command Complete (0x0e) plen 4 #115 [hci0] 10.923760
LE Set Extended Advertising Enable (0x08|0x0039) ncmd 2
Status: Success (0x00)
< HCI Command: LE Set Extended A.. (0x08|0x0036) plen 25 #116 [hci0] 10.924022
Handle: 0x01
Properties: 0x0013
Connectable
Scannable
Use legacy advertising PDUs: ADV_IND
Min advertising interval: 37.500 msec (0x003c)
Max advertising interval: 37.500 msec (0x003c)
Channel map: 37, 38, 39 (0x07)
Own address type: Public (0x00)
Peer address type: Public (0x00)
Peer address: 00:00:00:00:00:00 (OUI 00-00-00)
Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
TX power: 0 dbm (0x00)
Primary PHY: LE 1M (0x01)
Secondary max skip: 0x00
Secondary PHY: LE 1M (0x01)
SID: 0x00
Scan request notifications: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 5 #117 [hci0] 10.927608
LE Set Extended Advertising Parameters (0x08|0x0036) ncmd 2
Status: Success (0x00)
TX power (selected): 0 dbm (0x00)
< HCI Command: LE Set Extended Ad.. (0x08|0x0039) plen 6 #118 [hci0] 10.928040
Extended advertising: Enabled (0x01)
Number of sets: 1 (0x01)
Entry 0
Handle: 0x01
Duration: 0 ms (0x00)
Max ext adv events: 0
> HCI Event: Command Complete (0x0e) plen 4 #119 [hci0] 10.933897
LE Set Extended Advertising Enable (0x08|0x0039) ncmd 2
Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19 #120 [hci0] 10.942881
LE Connection Complete (0x01)
Status: Success (0x00)
Handle: 24
Role: Peripheral (0x01)
Peer address type: Random (0x01)
Peer address: 48:AD:99:8B:C5:3D (Resolvable)
Connection interval: 45.00 msec (0x0024)
Connection latency: 0 (0x0000)
Supervision timeout: 5000 msec (0x01f4)
Central clock accuracy: 0x01
# MGMT Event: Device Connected (0x000b) plen 13 {0x0001} [hci0] 10.943295
LE Address: 48:AD:99:8B:C5:3D (Resolvable)
Flags: 0x00000000
Data length: 0
< HCI Command: LE Read Remote Use.. (0x08|0x0016) plen 2 #121 [hci0] 10.943372
Handle: 24
> HCI Event: LE Meta Event (0x3e) plen 6 #122 [hci0] 10.944681
LE Advertising Set Terminated (0x12)
Status: Success (0x00)
Handle: 1
Connection handle: 24
Number of completed extended advertising events: 0
> HCI Event: Command Status (0x0f) plen 4 #123 [hci0] 10.946984
LE Read Remote Used Features (0x08|0x0016) ncmd 2
Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 4 #124 [hci0] 10.979349
LE Channel Selection Algorithm (0x14)
Handle: 24
Algorithm: #2 (0x01)
> HCI Event: LE Meta Event (0x3e) plen 12 #125 [hci0] 11.024865
LE Read Remote Used Features (0x04)
Status: Success (0x00)
Handle: 24
Features: 0xbd 0x7f 0x00 0x37 0x01 0x00 0x00 0x00
LE Encryption
Extended Reject Indication
Peripheral-initiated Features Exchange
LE Ping
LE Data Packet Length Extension
Extended Scanner Filter Policies
LE 2M PHY
Stable Modulation Index - Transmitter
Stable Modulation Index - Receiver
LE Coded PHY
LE Extended Advertising
LE Periodic Advertising
Channel Selection Algorithm #2
Periodic Advertising Sync Transfer - Sender
Periodic Advertising Sync Transfer - Recipient
Sleep Clock Accuracy Updates
Connected Isochronous Stream - Central
Connected Isochronous Stream - Peripheral
Isochronous Channels (Host Support)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #126 [hci0] 11.158694
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 9 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 75
Source CID: 82
Source CID: 64
Source CID: 65
Source CID: 66
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #127 [hci0] 11.159017
LE L2CAP: Command Reject (0x01) ident 9 len 2
Reason: Command not understood (0x0000)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #128 [hci0] 11.160874
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 10 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 75
Source CID: 82
Source CID: 64
Source CID: 65
Source CID: 66
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #129 [hci0] 11.161137
LE L2CAP: Command Reject (0x01) ident 10 len 2
Reason: Command not understood (0x0000)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #130 [hci0] 11.162536
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 11 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 75
Source CID: 82
Source CID: 64
Source CID: 65
Source CID: 66
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #131 [hci0] 11.162874
LE L2CAP: Command Reject (0x01) ident 11 len 2
Reason: Command not understood (0x0000)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #132 [hci0] 11.164513
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 12 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 75
Source CID: 82
Source CID: 64
Source CID: 65
Source CID: 66
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #133 [hci0] 11.164839
LE L2CAP: Command Reject (0x01) ident 12 len 2
Reason: Command not understood (0x0000)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #134 [hci0] 11.166441
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 13 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 75
Source CID: 82
Source CID: 64
Source CID: 65
Source CID: 66
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #135 [hci0] 11.166739
LE L2CAP: Command Reject (0x01) ident 13 len 2
Reason: Command not understood (0x0000)
> ACL Data RX: Handle 24 flags 0x02 dlen 26 #136 [hci0] 11.168433
LE L2CAP: Enhanced Credit Connection Request (0x17) ident 14 len 18
PSM: 39 (0x0027)
MTU: 256
MPS: 251
Credits: 65535
Source CID: 75
Source CID: 82
Source CID: 64
Source CID: 65
Source CID: 66
< ACL Data TX: Handle 24 flags 0x00 dlen 10 #137 [hci0] 11.168788
LE L2CAP: Command Reject (0x01) ident 14 len 2
Reason: Command not understood (0x0000)
> HCI Event: Number of Completed Packets (0x13) plen 5 #138 [hci0] 11.207392
Num handles: 1
Handle: 24
Count: 1
> HCI Event: LE Meta Event (0x3e) plen 11 #139 [hci0] 11.211700
LE Data Length Change (0x07)
Handle: 24
Max TX octets: 251
Max TX time: 2120
Max RX octets: 27
Max RX time: 328
> HCI Event: Number of Completed Packets (0x13) plen 5 #140 [hci0] 11.213812
Num handles: 1
Handle: 24
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 #141 [hci0] 11.217827
Num handles: 1
Handle: 24
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 #142 [hci0] 11.221915
Num handles: 1
Handle: 24
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 #143 [hci0] 11.225994
Num handles: 1
Handle: 24
Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5 #144 [hci0] 11.251600
Num handles: 1
Handle: 24
Count: 1
# MGMT Command: Disconnect (0x0014) plen 7 {0x0001} [hci0] 14.821568
LE Address: 48:AD:99:8B:C5:3D (Resolvable)
< HCI Command: Disconnect (0x01|0x0006) plen 3 #145 [hci0] 14.821608
Handle: 24
Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4 #146 [hci0] 14.830653
Disconnect (0x01|0x0006) ncmd 2
Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4 #147 [hci0] 14.896228
Status: Success (0x00)
Handle: 24
Reason: Connection Terminated By Local Host (0x16)
# MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 14.896709
Disconnect (0x0014) plen 7
Status: Success (0x00)
LE Address: 48:AD:99:8B:C5:3D (Resolvable)
For this project, I would like the peripheral to be able to disconnect, without getting stuck in the connect/disconnect loop.
Attempting to manually disconnect via the console in the bluetoothctl menu returns the same results.
It doesn't seem that the error is in my application. Debug statements proof that the connect method doesn't get called.
Does anyone have any suggestions/solutions for this problem?

Pic32_MZEF_Curiosity_v2: USB Device only (Audio + CDC) Not Working

This is the first time for me in a USB environment hence any input is highly appreciated.
My Setup:
-Pic32 ME EF curiosity v2 board + AK4954 Codec Module attached to mikro Bus 2 using Mplab x 5V5 IDE under Harmony 3
-My current project code/ example codes / Wireshark data WIP here
-default microchip audio & cdc examples are functional
Desired result:(USB Device mode only)
I would like to emulate USB headphones (Audio playing from YT video on android phone) + CDC (custom data sent to serial USB terminal app on Android upon button press)
My progress:
I've used the default Microchip functional audio example & integrated the CDC example into it.
My USB composite device is enumerated correctly into my PC (device manager) & then I'm receiving
“This device cannot start. (Code 10)” on windows I use a software named “UsbTreeView” I checked it and It’s telling me like this:
----------------- Device Qualifier Descriptor -----------------
Error : ERROR_GEN_FAILURE
if I’ve understood the USB concept well -> The IAD(Interface
association descriptor) is also declared accurately. but I'm having a
doubt on configuration descriptors.
In windows, it shows The com port(CDC is enumerated correctly but the
audio is in an error state) but when I tried using putty no data is
flowing through but I could see the data sent from the board on
Wireshark upon button press.
I've also attached the Wireshark log as when I press the button I can see the interrupt + data sent from the device to the host. (but with this error:IRP USBD_STATUS: USBD_STATUS_CANCELED (0xc0010000))
I then connected this to my android phone & the audio is functional &
CDC terminal station "control transfer failed"
I also connected this to UBUNTU PC & the audio is functional properly
& CDC terminal TTYACM0 "Terminal open failed " by the app "Screen"
Device Descriptors
Information for device USB Headset PIC32MZEF AUD + CDC (VID=0x04D8 PID=0x0065):
------------------------------
Connection Information:
------------------------------
Device current bus speed: FullSpeed
Device supports USB 1.1 specification
Device supports USB 2.0 specification
Device address: 0x001A
Current configuration value: 0x01
Number of open pipes: 3
------------------------------
Device Descriptor:
------------------------------
0x12 bLength
0x01 bDescriptorType
0x0200 bcdUSB
0x00 bDeviceClass
0x00 bDeviceSubClass
0x00 bDeviceProtocol
0x40 bMaxPacketSize0 (64 bytes)
0x04D8 idVendor
0x0065 idProduct
0x0100 bcdDevice
0x01 iManufacturer "Microchip Technology Inc."
0x02 iProduct "USB Headset PIC32MZEF AUD + CDC"
0x03 iSerialNumber "12345678999"
0x01 bNumConfigurations
-------------------------
Configuration Descriptor:
-------------------------
0x09 bLength
0x02 bDescriptorType
0x012C wTotalLength (300 bytes)
0x05 bNumInterfaces
0x01 bConfigurationValue
0x00 iConfiguration
0xC0 bmAttributes (Self-powered Device)
0x32 bMaxPower (100 mA)
Interface Descriptor:
------------------------------
0x09 bLength
0x04 bDescriptorType
0x00 bInterfaceNumber
0x00 bAlternateSetting
0x00 bNumEndPoints
0x01 bInterfaceClass (Audio Device Class)
0x01 bInterfaceSubClass (Audio Control Interface)
0x00 bInterfaceProtocol (Audio Protocol undefined)
0x00 iInterface
AC Interface Header Descriptor:
------------------------------
0x0A bLength
0x24 bDescriptorType
0x01 bDescriptorSubtype
0x0100 bcdADC
0x0064 wTotalLength (100 bytes)
0x02 bInCollection
0x01 baInterfaceNr(1)
0x02 baInterfaceNr(2)
AC Input Terminal Descriptor:
------------------------------
0x0C bLength
0x24 bDescriptorType
0x02 bDescriptorSubtype
0x01 bTerminalID
0x0101 wTerminalType (USB Streaming)
0x00 bAssocTerminal
0x02 bNrChannels (2 channels)
0x0003 wChannelConfig
0x00 iChannelNames
0x00 iTerminal
AC Input Terminal Descriptor:
------------------------------
0x0C bLength
0x24 bDescriptorType
0x02 bDescriptorSubtype
0x04 bTerminalID
0x0201 wTerminalType (Microphone)
0x00 bAssocTerminal
0x01 bNrChannels (1 channels)
0x0004 wChannelConfig
0x00 iChannelNames
0x00 iTerminal
AC Feature Unit Descriptor:
------------------------------
0x0D bLength
0x24 bDescriptorType
0x06 bDescriptorSubtype
0x02 bUnitID
0x08 bSourceID
0x02 bControlSize
bmaControls:
0x01 Channel(0) - Mute
0x00 Channel(1)
0x00 Channel(2)
0x00 iFeature
AC Feature Unit Descriptor:
------------------------------
0x0B bLength
0x24 bDescriptorType
0x06 bDescriptorSubtype
0x05 bUnitID
0x04 bSourceID
0x02 bControlSize
bmaControls:
0x01 Channel(0) - Mute
0x00 Channel(1)
0x00 iFeature
AC Feature Unit Descriptor:
------------------------------
0x0B bLength
0x24 bDescriptorType
0x06 bDescriptorSubtype
0x07 bUnitID
0x04 bSourceID
0x02 bControlSize
bmaControls:
0x01 Channel(0) - Mute
0x00 Channel(1)
0x00 iFeature
AC Mixer Unit Descriptor:
------------------------------
0x0D bLength
0x24 bDescriptorType
0x04 bDescriptorSubtype
0x08 bUnitID
0x02 bBrInPins
0x01 baSourceID(1)
0x07 baSourceID(2)
0x02 bNrChannels
0x0003 wChannelConfig
0x00 iChannelNames
bmControls:
0x00
0x00 iMixer
AC Output Terminal Descriptor:
------------------------------
0x09 bLength
0x24 bDescriptorType
0x03 bDescriptorSubtype
0x03 bTerminalID
0x0302 wTerminalType (Headphones)
0x00 bAssocTerminal
0x02 bSourceID
0x00 iTerminal
AC Output Terminal Descriptor:
------------------------------
0x09 bLength
0x24 bDescriptorType
0x03 bDescriptorSubtype
0x06 bTerminalID
0x0101 wTerminalType (USB Streaming)
0x00 bAssocTerminal
0x05 bSourceID
0x00 iTerminal
Interface Descriptor:
------------------------------
0x09 bLength
0x04 bDescriptorType
0x01 bInterfaceNumber
0x00 bAlternateSetting
0x00 bNumEndPoints
0x01 bInterfaceClass (Audio Device Class)
0x02 bInterfaceSubClass (Audio Streaming Interface)
0x00 bInterfaceProtocol (Audio Protocol undefined)
0x00 iInterface
Interface Descriptor:
------------------------------
0x09 bLength
0x04 bDescriptorType
0x01 bInterfaceNumber
0x01 bAlternateSetting
0x01 bNumEndPoints
0x01 bInterfaceClass (Audio Device Class)
0x02 bInterfaceSubClass (Audio Streaming Interface)
0x00 bInterfaceProtocol (Audio Protocol undefined)
0x00 iInterface
AS Interface Descriptor:
------------------------------
0x07 bLength
0x24 bDescriptorType
0x01 bDescriptorSubtype
0x01 bTerminalLink
0x01 bDelay
0x0001 wFormatTag (PCM)
AS Format Type 1 Descriptor:
------------------------------
0x11 bLength
0x24 bDescriptorType
0x02 bDescriptorSubtype
0x01 bFormatType (FORMAT_TYPE_1)
0x02 bNrChannels (2 channels)
0x02 bSubframeSize
0x10 bBitResolution (16 bits per sample)
0x03 bSamFreqType (Discrete sampling frequencies)
0x003E80 tSamFreq(1) (16000 Hz)
0x007D00 tSamFreq(2) (32000 Hz)
0x00BB80 tSamFreq(3) (48000 Hz)
Endpoint Descriptor (Audio/MIDI 1.0):
------------------------------
0x09 bLength
0x05 bDescriptorType
0x01 bEndpointAddress (OUT endpoint 1)
0x09 bmAttributes (Transfer: Isochronous / Synch: Adaptive / Usage: Data)
0x00C0 wMaxPacketSize (1 x 192 bytes)
0x01 bInterval (1 frames)
0x00 bRefresh
0x00 bSynchAddress
AS Isochronous Data Endpoint Descriptor:
------------------------------
0x07 bLength
0x25 bDescriptorType
0x01 bDescriptorSubtype
0x01 bmAttributes (Sampling Frequency)
0x00 bLockDelayUnits (undefined)
0x0000 wLockDelay
Interface Descriptor:
------------------------------
0x09 bLength
0x04 bDescriptorType
0x02 bInterfaceNumber
0x00 bAlternateSetting
0x00 bNumEndPoints
0x01 bInterfaceClass (Audio Device Class)
0x02 bInterfaceSubClass (Audio Streaming Interface)
0x00 bInterfaceProtocol (Audio Protocol undefined)
0x00 iInterface
Interface Descriptor:
------------------------------
0x09 bLength
0x04 bDescriptorType
0x02 bInterfaceNumber
0x01 bAlternateSetting
0x01 bNumEndPoints
0x01 bInterfaceClass (Audio Device Class)
0x02 bInterfaceSubClass (Audio Streaming Interface)
0x00 bInterfaceProtocol (Audio Protocol undefined)
0x00 iInterface
AS Interface Descriptor:
------------------------------
0x07 bLength
0x24 bDescriptorType
0x01 bDescriptorSubtype
0x06 bTerminalLink
0x00 bDelay
0x0001 wFormatTag (PCM)
AS Format Type 1 Descriptor:
------------------------------
0x11 bLength
0x24 bDescriptorType
0x02 bDescriptorSubtype
0x01 bFormatType (FORMAT_TYPE_1)
0x01 bNrChannels (1 channels)
0x02 bSubframeSize
0x10 bBitResolution (16 bits per sample)
0x03 bSamFreqType (Discrete sampling frequencies)
0x003E80 tSamFreq(1) (16000 Hz)
0x007D00 tSamFreq(2) (32000 Hz)
0x00BB80 tSamFreq(3) (48000 Hz)
Endpoint Descriptor (Audio/MIDI 1.0):
------------------------------
0x09 bLength
0x05 bDescriptorType
0x82 bEndpointAddress (IN endpoint 2)
0x0D bmAttributes (Transfer: Isochronous / Synch: Synchronous / Usage: Data)
0x0060 wMaxPacketSize (1 x 96 bytes)
0x01 bInterval (1 frames)
0x00 bRefresh
0x00 bSynchAddress
AS Isochronous Data Endpoint Descriptor:
------------------------------
0x07 bLength
0x25 bDescriptorType
0x01 bDescriptorSubtype
0x01 bmAttributes (Sampling Frequency)
0x00 bLockDelayUnits (undefined)
0x0000 wLockDelay
Interface Association Descriptor:
------------------------------
0x08 bLength
0x0B bDescriptorType
0x03 bFirstInterface
0x02 bInterfaceCount
0x02 bFunctionClass (Communication Device Class)
0x02 bFunctionSubClass (Abstract Control Model - ACM)
0x01 bFunctionProtocol (ITU-T V.250)
0x00 iFunction
Interface Descriptor:
------------------------------
0x09 bLength
0x04 bDescriptorType
0x03 bInterfaceNumber
0x00 bAlternateSetting
0x01 bNumEndPoints
0x02 bInterfaceClass (Communication Device Class)
0x02 bInterfaceSubClass (Abstract Control Model - ACM)
0x01 bInterfaceProtocol (ITU-T V.250)
0x00 iInterface
CDC Header Functional Descriptor:
------------------------------
0x05 bFunctionalLength
0x24 bDescriptorType
0x00 bDescriptorSubtype
0x0120 bcdCDC
CDC Abstract Control Management Functional Descriptor:
------------------------------
0x04 bFunctionalLength
0x24 bDescriptorType
0x02 bDescriptorSubtype
0x02 bmCapabilities
CDC Union Functional Descriptor:
------------------------------
0x05 bFunctionalLength
0x24 bDescriptorType
0x06 bDescriptorSubtype
0x03 bControlInterface
0x04 bSubordinateInterface(0)
CDC Call Management Functional Descriptor:
------------------------------
0x05 bFunctionalLength
0x24 bDescriptorType
0x01 bDescriptorSubtype
0x00 bmCapabilities
0x04 bDataInterface
Endpoint Descriptor:
------------------------------
0x07 bLength
0x05 bDescriptorType
0x83 bEndpointAddress (IN endpoint 3)
0x03 bmAttributes (Transfer: Interrupt / Synch: None / Usage: Data)
0x0010 wMaxPacketSize (1 x 16 bytes)
0x02 bInterval (2 frames)
Interface Descriptor:
------------------------------
0x09 bLength
0x04 bDescriptorType
0x04 bInterfaceNumber
0x00 bAlternateSetting
0x02 bNumEndPoints
0x0A bInterfaceClass (CDC Data)
0x00 bInterfaceSubClass
0x00 bInterfaceProtocol
0x00 iInterface
Endpoint Descriptor:
------------------------------
0x07 bLength
0x05 bDescriptorType
0x04 bEndpointAddress (OUT endpoint 4)
0x02 bmAttributes (Transfer: Bulk / Synch: None / Usage: Data)
0x0040 wMaxPacketSize (64 bytes)
0x00 bInterval
Endpoint Descriptor:
------------------------------
0x07 bLength
0x05 bDescriptorType
0x84 bEndpointAddress (IN endpoint 4)
0x02 bmAttributes (Transfer: Bulk / Synch: None / Usage: Data)
0x0040 wMaxPacketSize (64 bytes)
0x00 bInterval
Microsoft OS Descriptor is not available. Error code: 0x0000001F
--------------------------------
String Descriptor Table
--------------------------------
Index LANGID String
0x00 0x0000 0x0409
0x01 0x0409 "Microchip Technology Inc."
0x02 0x0409 "USB Headset PIC32MZEF AUD + CDC"
0x03 0x0409 "12345678999"
------------------------------
Connection path for device:
USB xHCI Compliant Host Controller
Root Hub
Generic USB Hub
Generic USB Hub
USB Headset PIC32MZEF AUD + CDC (VID=0x04D8 PID=0x0065) Port: 1
Running on: Windows 10 or greater (Build Version 19044)
Brought to you by TDD v2.17.0, Feb 23 2021, 14:04:02
Please let me know the possible solutions & which area should I focus more on?
Thanks for your time. I really appreciate it
Have a good day

BLE Battery Level Service doesn't read phone battery level

My Setup
I'm using a TI Launchpad as a Bluetooth Low Energy Central Device, and my Samsung Galaxy S21 as a Peripheral. I'm using bTool (for my launchpad) and nRF Connect (for the phone).
From nRF Connect, I'm making my phone advertise data, so that the Launchpad can connect to it (from bTool). Everything works fine until this point.
I used the "Configure GATT Server" option from nRF Connect, added a Custom Service and selected Battery Level Service. Also added a Battery Level Characteristic, with "NOTIFY" and "READ" permissions, that also includes two Descriptors: Client Characteristic Configuration and Characteristic Presentation Format.
Expected Result
What I'm trying to do is, create a Battery Level Service (directly from the nRF Connect mobile app) that measures the battery level of my phone and sends it to my Launchpad.
The problem is, when opening bTool, I see that the battery level of my phone is not read. I can input some values by myself from the phone, but I would like the battery level of my phone to be read.
Also, I would like to be notified whenever the battery level has changed.
My question is: what did I do wrong? Does Battery Level Service actually take the battery information from the peripheral, or is it not intended for that?
** update **
This is the Battery Level service in my nRF Connect, together with its characteristics + permissions:
https://i.stack.imgur.com/TqYeK.jpg
Also, this is my bTool log, where I display all of the peripheral's services and write 01:00 to the Client Characteristic Configuration descriptor:
[1] : <Tx> - 11:40:18.260
-Type : 0x01 (Command)
-OpCode : 0xFD84 (GATT_DiscAllCharDescs)
-Data Length : 0x06 (6) byte(s)
ConnHandle : 0x0000 (0)
StartHandle : 0x0001 (1)
EndHandle : 0xFFFF (65535)
Dump(Tx):
0000:01 84 FD 06 00 00 01 00 FF FF ..........
--------------------------------------------------------------------
[2] : <Rx> - 11:40:18.290
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (0) (SUCCESS)
OpCode : 0xFD84 (GATT_DiscAllCharDescs)
DataLength : 0x00 (0)
Dump(Rx):
0000:04 FF 06 7F 06 00 84 FD 00 .........
--------------------------------------------------------------------
[3] : <Rx> - 11:40:18.411
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x17 (23) bytes(s)
Event : 0x0505 (1285) (ATT_FindInfoRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x11 (17)
Format : 0x01 (1) (HANDLE_BT_UUID_TYPE__handles_and_16_bit_Bluetooth_UUIDs)
Handle : 0001
Uuid : 00:28
Handle : 0014
Uuid : 00:28
Handle : 0028
Uuid : 00:28
Handle : 002F
Uuid : 00:28
Dump(Rx):
0000:04 FF 17 05 05 00 00 00 11 01 01 00 00 28 14 00 .............(..
0010:00 28 28 00 00 28 2F 00 00 28 .((..(/..(
--------------------------------------------------------------------
[4] : <Rx> - 11:40:18.610
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x0B (11) bytes(s)
Event : 0x0505 (1285) (ATT_FindInfoRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x05 (5)
Format : 0x01 (1) (HANDLE_BT_UUID_TYPE__handles_and_16_bit_Bluetooth_UUIDs)
Handle : 0030
Uuid : 03:28
Dump(Rx):
0000:04 FF 0B 05 05 00 00 00 05 01 30 00 03 28 ..........0..(
--------------------------------------------------------------------
[5] : <Rx> - 11:40:18.798
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x0B (11) bytes(s)
Event : 0x0505 (1285) (ATT_FindInfoRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x05 (5)
Format : 0x01 (1) (HANDLE_BT_UUID_TYPE__handles_and_16_bit_Bluetooth_UUIDs)
Handle : 0031
Uuid : 19:2A
Dump(Rx):
0000:04 FF 0B 05 05 00 00 00 05 01 31 00 19 2A ..........1..*
--------------------------------------------------------------------
[6] : <Rx> - 11:40:19.004
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x0B (11) bytes(s)
Event : 0x0505 (1285) (ATT_FindInfoRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x05 (5)
Format : 0x01 (1) (HANDLE_BT_UUID_TYPE__handles_and_16_bit_Bluetooth_UUIDs)
Handle : 0032
Uuid : 02:29
Dump(Rx):
0000:04 FF 0B 05 05 00 00 00 05 01 32 00 02 29 ..........2..)
--------------------------------------------------------------------
[7] : <Rx> - 11:40:19.193
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x0505 (1285) (ATT_FindInfoRsp)
Status : 0x1A (26) (bleProcedureComplete)
ConnHandle : 0x0000 (0)
PduLen : 0x00 (0)
Dump(Rx):
0000:04 FF 06 05 05 1A 00 00 00 .........
--------------------------------------------------------------------
[8] : <Tx> - 11:40:24.896
-Type : 0x01 (Command)
-OpCode : 0xFD92 (GATT_WriteCharValue)
-Data Length : 0x06 (6) byte(s)
ConnHandle : 0x0000 (0)
Handle : 0x0032 (50)
Value : 01:00
Dump(Tx):
0000:01 92 FD 06 00 00 32 00 01 00 ......2...
--------------------------------------------------------------------
[9] : <Rx> - 11:40:24.942
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (0) (SUCCESS)
OpCode : 0xFD92 (GATT_WriteCharValue)
DataLength : 0x00 (0)
Dump(Rx):
0000:04 FF 06 7F 06 00 92 FD 00 .........
--------------------------------------------------------------------
[10] : <Rx> - 11:40:25.085
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x0513 (1299) (ATT_WriteRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x00 (0)
Dump(Rx):
0000:04 FF 06 13 05 00 00 00 00 .........
--------------------------------------------------------------------
** update (2) **
Log starting from GATT_DiscAllPrimaryServices:
[1] : <Tx> - 09:37:03.083
-Type : 0x01 (Command)
-OpCode : 0xFD90 (GATT_DiscAllPrimaryServices)
-Data Length : 0x02 (2) byte(s)
ConnHandle : 0x0000 (0)
Dump(Tx):
0000:01 90 FD 02 00 00 ......
--------------------------------------------------------------------
[2] : <Rx> - 09:37:03.113
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (0) (SUCCESS)
OpCode : 0xFD90 (GATT_DiscAllPrimaryServices)
DataLength : 0x00 (0)
Dump(Rx):
0000:04 FF 06 7F 06 00 90 FD 00 .........
--------------------------------------------------------------------
[3] : <Rx> - 09:37:03.249
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x13 (19) bytes(s)
Event : 0x0511 (1297) (ATT_ReadByGrpTypeRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x0D (13)
Length : 0x06 (6)
DataList
AttrHandle : 0001
EndGrpHandle : 0003
Value : 01:18
AttrHandle : 0014
EndGrpHandle : 001A
Value : 00:18
Dump(Rx):
0000:04 FF 13 11 05 00 00 00 0D 06 01 00 03 00 01 18 ................
0010:14 00 1A 00 00 18 ......
--------------------------------------------------------------------
[4] : <Rx> - 09:37:03.430
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x1B (27) bytes(s)
Event : 0x0511 (1297) (ATT_ReadByGrpTypeRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x15 (21)
Length : 0x14 (20)
DataList
AttrHandle : 0028
EndGrpHandle : 002E
Value : 25:81:E8:8C:72:2E:8F:97:EA:11:DB:31:FC:34:4A:59
Dump(Rx):
0000:04 FF 1B 11 05 00 00 00 15 14 28 00 2E 00 25 81 ..........(...%.
0010:E8 8C 72 2E 8F 97 EA 11 DB 31 FC 34 4A 59 ..r......1.4JY
--------------------------------------------------------------------
[5] : <Rx> - 09:37:03.631
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x0D (13) bytes(s)
Event : 0x0511 (1297) (ATT_ReadByGrpTypeRsp)
Status : 0x00 (0) (SUCCESS)
ConnHandle : 0x0000 (0)
PduLen : 0x07 (7)
Length : 0x06 (6)
DataList
AttrHandle : 002F
EndGrpHandle : FFFF
Value : 0F:18
Dump(Rx):
0000:04 FF 0D 11 05 00 00 00 07 06 2F 00 FF FF 0F 18 ........../.....
--------------------------------------------------------------------
[6] : <Rx> - 09:37:03.646
-Type : 0x04 (Event)
-EventCode : 0x00FF (HCI_LE_ExtEvent)
-Data Length : 0x06 (6) bytes(s)
Event : 0x0511 (1297) (ATT_ReadByGrpTypeRsp)
Status : 0x1A (26) (bleProcedureComplete)
ConnHandle : 0x0000 (0)
PduLen : 0x00 (0)
Dump(Rx):
0000:04 FF 06 11 05 1A 00 00 00 .........
--------------------------------------------------------------------

What is the path of OAT file in Android 7?

There is a similar question:
What is the path of OAT file in Android 5.0
But Android 7, in the same path:
/data/dalvik-cache/<ARCH>/
I can't find the user-installed app, but only the system ones.
Where can I find the oat file generated by the normal installation of an app?
I found the oat file generated by the normal installation of an app in:
/data/app/<PACKAGE_NAME>/oat/<ARCH>/base.odex
And I verified that is an oat file running (on my machine, not in Android) the command:
$ readelf -e base.odex
ELF Header:
Magic: 7f 45 4c 46 01 01 01 03 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - GNU
ABI Version: 0
Type: DYN (Shared object file)
Machine: ARM
Version: 0x1
Entry point address: 0x0
Start of program headers: 52 (bytes into file)
Start of section headers: 3928128 (bytes into file)
Flags: 0x5000000, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 7
Size of section headers: 40 (bytes)
Number of section headers: 9
Section header string table index: 8
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .rodata PROGBITS 00001000 001000 34f000 00 A 0 0 4096
[ 2] .text PROGBITS 00350000 350000 06c3f4 00 AX 0 0 4096
[ 3] .bss NOBITS 003bd000 000000 034604 00 A 0 0 4096
[ 4] .dynstr STRTAB 003f2000 3bd000 00003d 00 A 0 0 4096
[ 5] .dynsym DYNSYM 003f2040 3bd040 000060 10 A 4 0 4
[ 6] .hash HASH 003f20a0 3bd0a0 000024 04 A 5 0 4
[ 7] .dynamic DYNAMIC 003f3000 3be000 000038 08 A 4 0 4096
[ 8] .shstrtab STRTAB 00000000 3bf000 00003d 00 0 0 4096
...
because it contains the .rodata and .text headers as described in: http://newandroidbook.com/files/Andevcon-ART.pdf

Android NDK produce unreasonable big binaries, how to optimize .so size?

I have notice that Android NDK (r6b in my case) produce unreasonable big resulting .so files. For example, in my case I have ~150-200 lines of C++ code (6 native methods and 3 C++ simplest classes) and this native code produce 60kb (!) .so with enabled exceptions and RTTI or 12kb .so with disabled exceptions and RTTI. Just to check I have compile hello-jni example included in NDK package and get 10kb .so for single-line native method from this example.
In my opinion it is somehow unreasonable overhead for mobile platform (on my desktop the comparable by size code produce ~10-15 times less .so).
Are there tricks I should know to reduce the binaries size ?
Why there is such overhead for C-only code ?
And why there is even bigger overhead for C++ code with enabled exceptions and RTTI ?
Update #1: readelf output for hello-jni example from NDK
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: ARM
Version: 0x1
Entry point address: 0xc18
Start of program headers: 52 (bytes into file)
Start of section headers: 9344 (bytes into file)
Flags: 0x5000002, has entry point, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 5
Size of section headers: 40 (bytes)
Number of section headers: 19
Section header string table index: 18
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .hash HASH 000000d4 0000d4 0001a4 04 A 2 0 4
[ 2] .dynsym DYNSYM 00000278 000278 000420 10 A 3 3 4
[ 3] .dynstr STRTAB 00000698 000698 0004aa 00 A 0 0 1
[ 4] .rel.dyn REL 00000b44 000b44 000048 08 A 2 0 4
[ 5] .rel.plt REL 00000b8c 000b8c 000030 08 A 2 6 4
[ 6] .plt PROGBITS 00000bbc 000bbc 00005c 04 AX 0 0 4
[ 7] .text PROGBITS 00000c18 000c18 001518 00 AX 0 0 4
[ 8] .rodata PROGBITS 00002130 002130 000014 01 AMS 0 0 4
[ 9] .ARM.extab PROGBITS 00002144 002144 000024 00 A 0 0 4
[10] .ARM.exidx ARM_EXIDX 00002168 002168 0000e0 00 AL 7 0 4
[11] .init_array INIT_ARRAY 00003248 002248 000008 00 WA 0 0 1
[12] .fini_array FINI_ARRAY 00003250 002250 00000c 00 WA 0 0 1
[13] .dynamic DYNAMIC 0000325c 00225c 0000e8 08 WA 3 0 4
[14] .got PROGBITS 00003344 002344 000040 04 WA 0 0 4
[15] .bss NOBITS 00003390 002384 000010 00 WA 0 0 16
[16] .comment PROGBITS 00000000 002384 000036 00 0 0 1
[17] .ARM.attributes ARM_ATTRIBUTES 00000000 0023ba 000029 00 0 0 1
[18] .shstrtab STRTAB 00000000 0023e3 00009b 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
There are no section groups in this file.
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
EXIDX 0x002168 0x00002168 0x00002168 0x000e0 0x000e0 R 0x4
LOAD 0x000000 0x00000000 0x00000000 0x02248 0x02248 R E 0x1000
LOAD 0x002248 0x00003248 0x00003248 0x0013c 0x00158 RW 0x1000
DYNAMIC 0x00225c 0x0000325c 0x0000325c 0x000e8 0x000e8 RW 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
Section to Segment mapping:
Segment Sections...
00 .ARM.exidx
01 .hash .dynsym .dynstr .rel.dyn .rel.plt .plt .text .rodata .ARM.extab .ARM.exidx
02 .init_array .fini_array .dynamic .got .bss
03 .dynamic
04
Dynamic section at offset 0x225c contains 25 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libstdc++.so]
0x00000001 (NEEDED) Shared library: [libm.so]
0x00000001 (NEEDED) Shared library: [libc.so]
0x00000001 (NEEDED) Shared library: [libdl.so]
0x0000000e (SONAME) Library soname: [libhello-jni.so]
0x00000010 (SYMBOLIC) 0x0
0x00000019 (INIT_ARRAY) 0x3248
0x0000001b (INIT_ARRAYSZ) 8 (bytes)
0x0000001a (FINI_ARRAY) 0x3250
0x0000001c (FINI_ARRAYSZ) 12 (bytes)
0x00000004 (HASH) 0xd4
0x00000005 (STRTAB) 0x698
0x00000006 (SYMTAB) 0x278
0x0000000a (STRSZ) 1194 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000003 (PLTGOT) 0x3344
0x00000002 (PLTRELSZ) 48 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0xb8c
0x00000011 (REL) 0xb44
0x00000012 (RELSZ) 72 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x00000016 (TEXTREL) 0x0
0x6ffffffa (RELCOUNT) 7
0x00000000 (NULL) 0x0
Relocation section '.rel.dyn' at offset 0xb44 contains 9 entries:
Offset Info Type Sym.Value Sym. Name
00000c24 00000017 R_ARM_RELATIVE
00003254 00000017 R_ARM_RELATIVE
00003368 00000017 R_ARM_RELATIVE
0000336c 00000017 R_ARM_RELATIVE
00003374 00000017 R_ARM_RELATIVE
00003378 00000017 R_ARM_RELATIVE
00003380 00000017 R_ARM_RELATIVE
00003370 00001015 R_ARM_GLOB_DAT 00000000 __cxa_call_unexpected
0000337c 00003215 R_ARM_GLOB_DAT 00000000 __gnu_Unwind_Find_exid
Relocation section '.rel.plt' at offset 0xb8c contains 6 entries:
Offset Info Type Sym.Value Sym. Name
00003350 00000d16 R_ARM_JUMP_SLOT 00000000 __cxa_begin_cleanup
00003354 00001216 R_ARM_JUMP_SLOT 00000000 memcpy
00003358 00001416 R_ARM_JUMP_SLOT 00000000 __cxa_finalize
0000335c 00001f16 R_ARM_JUMP_SLOT 00000000 abort
00003360 00002a16 R_ARM_JUMP_SLOT 00000000 __cxa_type_match
00003364 00003216 R_ARM_JUMP_SLOT 00000000 __gnu_Unwind_Find_exid
There are no unwind sections in this file.
Symbol table '.dynsym' contains 66 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000c18 0 SECTION LOCAL DEFAULT 7
2: 00003390 0 SECTION LOCAL DEFAULT 15
3: 00001c64 36 FUNC GLOBAL DEFAULT 7 ___Unwind_ForcedUnwind
4: 00001668 164 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_RaiseExcepti
5: 00001b20 0 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Save_VFP
6: 00001c40 36 FUNC GLOBAL DEFAULT 7 _Unwind_Resume_or_Rethrow
7: 00002248 0 NOTYPE GLOBAL DEFAULT ABS __exidx_end
8: 000011c0 8 FUNC GLOBAL DEFAULT 7 __aeabi_unwind_cpp_pr0
9: 00001d4c 44 FUNC GLOBAL DEFAULT 7 _Unwind_GetRegionStart
10: 00001c40 36 FUNC GLOBAL DEFAULT 7 ___Unwind_Resume_or_Rethr
11: 000033a0 0 NOTYPE GLOBAL DEFAULT ABS _bss_end__
12: 00001c88 36 FUNC GLOBAL DEFAULT 7 _Unwind_Backtrace
13: 00000000 0 NOTYPE WEAK DEFAULT UND __cxa_begin_cleanup
14: 00001b04 20 FUNC GLOBAL DEFAULT 7 __restore_core_regs
15: 00001b40 0 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Save_VFP_D_1
16: 00000000 0 NOTYPE WEAK DEFAULT UND __cxa_call_unexpected
17: 00000cf0 8 FUNC GLOBAL DEFAULT 7 _Unwind_GetCFA
18: 00000000 0 FUNC GLOBAL DEFAULT UND memcpy
19: 00000c8c 76 FUNC GLOBAL DEFAULT 7 _Unwind_VRS_Set
20: 00000000 0 FUNC GLOBAL DEFAULT UND __cxa_finalize
21: 00003250 0 NOTYPE GLOBAL DEFAULT 12 __FINI_ARRAY__
22: 00003384 0 NOTYPE GLOBAL DEFAULT ABS __bss_start__
23: 00001404 212 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Backtrace
24: 00003390 4 OBJECT GLOBAL DEFAULT 15 __dso_handle
25: 00001b30 0 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Save_VFP_D
26: 00001798 876 FUNC GLOBAL DEFAULT 7 _Unwind_VRS_Pop
27: 000011b0 8 FUNC WEAK DEFAULT 7 __aeabi_unwind_cpp_pr2
28: 00001c88 36 FUNC GLOBAL DEFAULT 7 ___Unwind_Backtrace
29: 00002168 0 NOTYPE GLOBAL DEFAULT ABS __exidx_start
30: 00001bf8 36 FUNC GLOBAL DEFAULT 7 ___Unwind_RaiseException
31: 00000000 0 FUNC GLOBAL DEFAULT UND abort
32: 00001c1c 36 FUNC GLOBAL DEFAULT 7 ___Unwind_Resume
33: 00001b48 0 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Restore_WMMX
34: 00001b18 0 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Restore_VFP
35: 00001c1c 36 FUNC GLOBAL DEFAULT 7 _Unwind_Resume
36: 00000cfc 32 FUNC GLOBAL DEFAULT 7 _Unwind_DeleteException
37: 00000cf8 4 FUNC GLOBAL DEFAULT 7 _Unwind_Complete
38: 000033a0 0 NOTYPE GLOBAL DEFAULT ABS __bss_end__
39: 00003248 0 NOTYPE GLOBAL DEFAULT 11 __INIT_ARRAY__
40: 00001d78 888 FUNC GLOBAL DEFAULT 7 __gnu_unwind_execute
41: 00001b28 0 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Restore_VFP_
42: 00000000 0 NOTYPE WEAK DEFAULT UND __cxa_type_match
43: 0000172c 108 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Resume
44: 00001b38 0 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Restore_VFP_
45: 00001bf8 36 FUNC GLOBAL DEFAULT 7 _Unwind_RaiseException
46: 00003384 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
47: 000033a0 0 NOTYPE GLOBAL DEFAULT ABS __end__
48: 000015f4 28 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_ForcedUnwind
49: 0000170c 32 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Resume_or_Re
50: 00000000 0 FUNC WEAK DEFAULT UND __gnu_Unwind_Find_exidx
51: 00001b04 20 FUNC GLOBAL DEFAULT 7 restore_core_regs
52: 00001be4 0 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Save_WMMXC
53: 00001d04 8 FUNC GLOBAL DEFAULT 7 _Unwind_GetTextRelBase
54: 00000c29 24 FUNC GLOBAL DEFAULT 7 Java_com_example_hellojni
55: 00001d14 56 FUNC GLOBAL DEFAULT 7 _Unwind_GetLanguageSpecif
56: 00000c40 76 FUNC GLOBAL DEFAULT 7 _Unwind_VRS_Get
57: 00001bd0 0 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Restore_WMMX
58: 000020f0 64 FUNC GLOBAL DEFAULT 7 __gnu_unwind_frame
59: 00001c64 36 FUNC GLOBAL DEFAULT 7 _Unwind_ForcedUnwind
60: 00003384 0 NOTYPE GLOBAL DEFAULT ABS _edata
61: 000033a0 0 NOTYPE GLOBAL DEFAULT ABS _end
62: 00001b8c 0 FUNC GLOBAL DEFAULT 7 __gnu_Unwind_Save_WMMXD
63: 000011b8 8 FUNC WEAK DEFAULT 7 __aeabi_unwind_cpp_pr1
64: 00001d0c 8 FUNC GLOBAL DEFAULT 7 _Unwind_GetDataRelBase
65: 00003384 0 NOTYPE GLOBAL DEFAULT 14 __data_start
Histogram for bucket list length (total of 37 buckets):
Length Number % of total Coverage
0 5 ( 13.5%)
1 14 ( 37.8%) 22.2%
2 9 ( 24.3%) 50.8%
3 6 ( 16.2%) 79.4%
4 2 ( 5.4%) 92.1%
5 1 ( 2.7%) 100.0%
No version information found in this file.
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "5TE"
Tag_CPU_arch: v5TE
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align8_needed: Yes
Tag_ABI_align8_preserved: Yes, except leaf SP
Tag_ABI_enum_size: int
You may see the difference from one provided by #Joel F, and especially stuff about stack unwinding (for C++ exceptions ?)
Update #2
The problem is in toolchain included in NDK r6b and in particular it is about of linker. Thanks to #Joel F for glues about previous NDK release. I have installed the NDK r5c alongside of NDK r6b and compare results. Compilers produce the same object files by both toolchains but after linking results are different.
EDIT 3
I was able to reproduce the 10KB hello-jni binary with NDK r6b. I found an awful hack here. Basically put this line in one of your files:
char __aeabi_unwind_cpp_pr0[0];
But your code will be lacking exception handling (which I thought was the point of -fno-exceptions....)
Anyways, this brings libhello-jni.so down to 2228 bytes for me. Still larger than r5c, but a lot less than 10KB.
EDIT 2
Yes it seems like you have a lot of C++ related overhead in your readelf output. Perhaps they changed something between r5c and r6b? There is no C++ code in r5c's hello-jni.c.
I have 160 lines of C code that NDK r5c reduces to a 3.8KB .so. Try the following to see what is responsible for the size:
/path/to/ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/<platform>/bin/arm-linux-androideabi-readelf -a libmylib.so
EDIT
I built the hello-jni example with NDK r5c and the resulting libhello-jni.so file is 1588 bytes.
Build command:
ndk-build V=1
Build output: http://pastebin.com/AdRDVbnF (apparently SO has limits on line length or something).
Output from readelf -a libhello-jni.so:
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: ARM
Version: 0x1
Entry point address: 0x2dc
Start of program headers: 52 (bytes into file)
Start of section headers: 1108 (bytes into file)
Flags: 0x5000002, has entry point, Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 5
Size of section headers: 40 (bytes)
Number of section headers: 12
Section header string table index: 11
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .hash HASH 000000d4 0000d4 00004c 04 A 2 0 4
[ 2] .dynsym DYNSYM 00000120 000120 0000e0 10 A 3 2 4
[ 3] .dynstr STRTAB 00000200 000200 0000db 00 A 0 0 1
[ 4] .text PROGBITS 000002dc 0002dc 00002c 00 AX 0 0 4
[ 5] .rodata PROGBITS 00000308 000308 000014 00 A 0 0 4
[ 6] .ARM.exidx ARM_EXIDX 0000031c 00031c 000008 00 AL 4 0 4
[ 7] .dynamic DYNAMIC 00001324 000324 000088 08 WA 3 0 4
[ 8] .got PROGBITS 000013ac 0003ac 00000c 04 WA 0 0 4
[ 9] .comment PROGBITS 00000000 0003b8 000012 00 0 0 1
[10] .ARM.attributes ARM_ATTRIBUTES 00000000 0003ca 000029 00 0 0 1
[11] .shstrtab STRTAB 00000000 0003f3 000061 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
There are no section groups in this file.
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
EXIDX 0x00031c 0x0000031c 0x0000031c 0x00008 0x00008 R 0x4
LOAD 0x000000 0x00000000 0x00000000 0x00324 0x00324 R E 0x1000
LOAD 0x000324 0x00001324 0x00001324 0x00094 0x00094 RW 0x1000
DYNAMIC 0x000324 0x00001324 0x00001324 0x00088 0x00088 RW 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
Section to Segment mapping:
Segment Sections...
00 .ARM.exidx
01 .hash .dynsym .dynstr .text .rodata .ARM.exidx
02 .dynamic .got
03 .dynamic
04
Dynamic section at offset 0x324 contains 12 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so]
0x00000001 (NEEDED) Shared library: [libstdc++.so]
0x00000001 (NEEDED) Shared library: [libm.so]
0x00000001 (NEEDED) Shared library: [libdl.so]
0x0000000e (SONAME) Library soname: [libhello-jni.so]
0x00000010 (SYMBOLIC) 0x0
0x00000004 (HASH) 0xd4
0x00000005 (STRTAB) 0x200
0x00000006 (SYMTAB) 0x120
0x0000000a (STRSZ) 219 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000000 (NULL) 0x0
There are no relocations in this file.
There are no unwind sections in this file.
Symbol table '.dynsym' contains 14 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 000002dc 0 SECTION LOCAL DEFAULT 4
2: 00000324 0 NOTYPE GLOBAL DEFAULT ABS __exidx_end
3: 00000000 0 FUNC GLOBAL DEFAULT UND __aeabi_unwind_cpp_pr0
4: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS _bss_end__
5: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS __bss_start__
6: 0000031c 0 NOTYPE GLOBAL DEFAULT ABS __exidx_start
7: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS __bss_end__
8: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
9: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS __end__
10: 000002dd 44 FUNC GLOBAL DEFAULT 4 Java_com_example_hellojni
11: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS _edata
12: 000013b8 0 NOTYPE GLOBAL DEFAULT ABS _end
13: 000013b8 0 NOTYPE GLOBAL DEFAULT 8 __data_start
Histogram for bucket list length (total of 3 buckets):
Length Number % of total Coverage
0 0 ( 0.0%)
1 0 ( 0.0%) 0.0%
2 1 ( 33.3%) 16.7%
3 0 ( 0.0%) 16.7%
4 1 ( 33.3%) 50.0%
5 0 ( 0.0%) 50.0%
6 1 ( 33.3%) 100.0%
No version information found in this file.
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "5TE"
Tag_CPU_arch: v5TE
Tag_THUMB_ISA_use: Thumb-1
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align8_needed: Yes
Tag_ABI_align8_preserved: Yes, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_optimization_goals: Aggressive Debug
The NDK toolchain supports C++ exceptions, since NDK r5, however all C++ sources are compiled with -fno-exceptions support by default, for compatibility reasons with previous releases.
To enable it, use the '-fexceptions' C++ compiler flag. This can be done by adding the following to every module definition in your Android.mk:
LOCAL_CPPFLAGS += -fexceptions
More simply, add a single line to your Application.mk, the setting will automatically apply to all your project's NDK modules:
APP_CPPFLAGS += -fexceptions
follow this page
But in NDK r6b, this FLAG is open by default, and can not close.
Don't use c++ exceptions if you want to have a lightweight mobile program. There's a reason c++ features were limited in early versions of the ndk. Android itself uses the subset of c++ that was thought cost effective on a mobile platform, and thats more or less what was originally supported.
Also be sure you are not doing a debug build with symbols included - that could be your hello-jni bloat.

Categories

Resources