-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: Classic: OBEX enablement #83781
base: main
Are you sure you want to change the base?
Conversation
Another massive PR? :) @lylezhu2012 I think the L2CAP and RFCOMM improvements could at least be split out into their own PRs. That way I think we can make faster progress with getting functionality merged incrementally. |
Actually, my PR only implements basic goep/obex operations, but goep and obex define too many concepts.
Well, I will remove all other layers changes from this PR. And make small PR for these changes. |
1dfaefe
to
e4a2256
Compare
e4a2256
to
f70741b
Compare
test failure is unrelated and will be fixed with #83907 |
f70741b
to
59ac793
Compare
4c7feba
to
2177c21
Compare
6ad4f54
to
8433ca6
Compare
11d4c7b
to
a31f46a
Compare
Add a Kconfig BT_GOEP to control the GOEP feature. Implement the GOEP protocol and transport, both for GOEP 1.1 and GOEP 2.x. For GOEP transport, OBEX over RFCOMM, and OBEX over L2CAP are supported. For GOEP protocol, `put`, `get`, `abort`, `setpath`, and `action` are supported. And only one operation can be processed at the same time. The feature `Reliable Session` is unsupported. Signed-off-by: Lyle Zhu <[email protected]>
The MTU of the GOEP should be not less than 255. So, if the transport is RFCOMM, the CONFIG_BT_BUF_ACL_RX_SIZE should be not less than 264. It includes, - 255 bytes for the minimum MTU of GOEP, - 4 bytes for L2CAP Header, - 5 bytes for RFCOMM header and FCS. And if the transport is L2CAP, the CONFIG_BT_BUF_ACL_RX_SIZE should be not less than 259. It includes, - 255 bytes for the minimum MTU of GOEP, - 4 bytes for L2CAP Header. Add Kconfig `BT_GOEP_RFCOMM_MTU` to configure the maximum size for RFCOMM transport. The range of `BT_GOEP_RFCOMM_MTU` is `[264, BT_RFCOMM_L2CAP_MTU]`. And the GOEP MTU via RFCOMM transport should be in the range `[255, (BT_GOEP_RFCOMM_MTU-9)]`. Add Kconfig `BT_GOEP_L2CAP_MTU` to configure the maximum size for L2CAP transport. The range of `BT_GOEP_L2CAP_MTU` is `[259, BT_BUF_ACL_RX_SIZE]`. And the GOEP MTU via L2CAP transport should be in the range `[255, (BT_GOEP_L2CAP_MTU-4)]`. Signed-off-by: Lyle Zhu <[email protected]>
Add commands for GOEP to test transport features. Add commands for transport over RFCOMM, including `register-rfcomm`, `connect-rfcomm`, and `disconnect-rfcomm`. Add commands for transport over L2CAP, including `register-l2cap`, `connect-l2cap`, and `disconnect-l2cap`. Signed-off-by: Lyle Zhu <[email protected]>
Add commands for GOEP to test OBEX features. Add command `alloc-buf` and `release-buf` to allocate and release TX buffer. Add command set `add-header` to add the OBEX headers to allocated TX buffer. Add command set `client` to send OBEX client requests with allocated TX buffer. Add command set `server` to send OBEX responses with allocated TX buffer. Signed-off-by: Lyle Zhu <[email protected]>
There are types of string can be added by using OBEX adding header function bt_obex_add_header_*(). One is byte sequence. Another is null terminated Unicode text. Add a function bt_obex_string_is_valid() to check if the added string is valid. And add a function bt_obex_unicode_is_valid() dedicated to check Unicode string. Signed-off-by: Lyle Zhu <[email protected]>
Add a structure `struct bt_obex_tlv` to pass/save the one TLV info. Use a array of `struct bt_obex_tlv` as the set of all TLV-triplets. Update the following functions to support the feature, including `bt_obex_add_header_app_param`, `bt_obex_add_header_auth_challenge`, and `bt_obex_add_header_auth_rsp`. Add a function `bt_obex_tlv_parse` to parse the encoded TLV-triplets. Signed-off-by: Lyle Zhu <[email protected]>
Add a TLV array `tlvs` to keep the pending TLV data. Update `app_param`, `auth_challenge`, and `auth_rsp` to set the one TLV information each time. When the optional argument `last` set, write the all pending TLVs to the tx buffer. Signed-off-by: Lyle Zhu <[email protected]>
a31f46a
to
718df54
Compare
According to the OBEX Version 1.5, the Name header could be a empty string. Update function `bt_obex_add_header_name` to support the case that the length of name could be 0. Update function `bt_obex_get_header_name` to support the case that the name header is found but the name length is 0. Signed-off-by: Lyle Zhu <[email protected]>
Add a Kconfig BT_GOEP to control the GOEP feature.
Implement the GOEP protocol and transport, both for GOEP 1.1 and GOEP 2.x.
For GOEP transport, OBEX over RFCOMM, and OBEX over L2CAP are supported.
For GOEP protocol,
put
,get
,abort
,setpath
, andaction
are supported. And only one operation can be processed at the same time. The featureReliable Session
is unsupported.The MTU of the GOEP should be not less than 255. So, if the transport is RFCOMM, the CONFIG_BT_BUF_ACL_RX_SIZE should be not less than 264.
It includes,
And if the transport is L2CAP, the CONFIG_BT_BUF_ACL_RX_SIZE should be not less than 259.
It includes,
Add Kconfig
BT_GOEP_RFCOMM_MTU
to configure the maximum size for RFCOMM transport. The range ofBT_GOEP_RFCOMM_MTU
is[264, BT_RFCOMM_L2CAP_MTU]
. And the GOEP MTU via RFCOMM transport should be in the range[255, (BT_GOEP_RFCOMM_MTU-9)]
.Add Kconfig
BT_GOEP_L2CAP_MTU
to configure the maximum size for L2CAP transport. The range ofBT_GOEP_L2CAP_MTU
is[259, BT_BUF_ACL_RX_SIZE]
. And the GOEP MTU via L2CAP transport should be in the range[255, (BT_GOEP_L2CAP_MTU-4)]
.Add commands for GOEP to test transport features.
Add commands for transport over RFCOMM, including
register-rfcomm
,connect-rfcomm
, anddisconnect-rfcomm
.Add commands for transport over L2CAP, including
register-l2cap
,connect-l2cap
, anddisconnect-l2cap
.Add commands for GOEP to test OBEX features.
Add command
alloc-buf
andrelease-buf
to allocate and release TX buffer.Add command set
add-header
to add the OBEX headers to allocated TX buffer.Add command set
client
to send OBEX client requests with allocated TX buffer.Add command set
server
to send OBEX responses with allocated TX buffer.There are types of string can be added by using OBEX adding header function bt_obex_add_header_*(). One is byte sequence. Another is null terminated Unicode text.
Add a function bt_obex_string_is_valid() to check if the added string is valid. And add a function bt_obex_unicode_is_valid() dedicated to check Unicode string.