Re: [PATCH BlueZ] device: add MTU D-Bus property

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

 



On 8/26/21 8:17 PM, Luiz Augusto von Dentz wrote:
Hi David,

On Thu, Aug 26, 2021 at 9:45 AM David Lechner <david@xxxxxxxxxxxxxx> wrote:

When using GATT write without response, it is useful to know how much
data can be sent in a single write. This value is the negotiated MTU
minus 3 bytes.

The D-bus method org.bluez.GattCharacteristic1.AcquireWrite returns the
MTU exactly for this reason. However, when using the alternate API
org.bluez.GattCharacteristic1.WriteValue with the options dictionary
{ "type": "command" }, there is no current way to get the MTU value.
If the value is too large, then the method returns "Failed to initiate
write" [org.bluez.Error.Failed].

In most cases the MTU is not that useful since each attribute has a

Access to the MTU has been a highly requested feature in
WebBluetooth[1] with reasonable use cases.

[1]: https://github.com/WebBluetoothCG/web-bluetooth/issues/383

maximum length of just a few bytes, the MTU is only really useful for
control points which I rather have using Acquire* variants. Note that
for long values the attribute must support Write Long Procedure and
afaik WriteValue does support that so it can fragment the data and
send according to the MTU.

I'm coming at this from the cross-platform point of view. Windows,
Apple and Android don't have an equivalent of AcquireWrite. They have
device-level methods/properties to get the MTU [2][3][4]. So instead
of forcing WebBluetooth to have an API compatible with AcquireWrite
it would be very nice to be able to get the required information
in a different way that is similar to the existing methods on other
platforms.

Maybe there are better alternatives to get the same information?
For example, the Apple API doesn't actually mention MTU, but rather
allows you to get the maximum write size for Write Without Response,
which I think is the value most use cases need (it just happens to
be MTU - 3).

[2]: https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattsession.maxpdusize?view=winrt-19041
[3]: https://developer.apple.com/documentation/corebluetooth/cbperipheral/1620312-maximumwritevaluelength
[4]: https://developer.android.com/reference/android/bluetooth/BluetoothGattCallback.html#onMtuChanged(android.bluetooth.BluetoothGatt,%20int,%20int)


This adds an "MTU" property to the org.bluez.Device1 interface that
is emitted in gatt_client_ready_cb() which is after the MTU exchange
has taken place.

This would not work for the likes of EATT which don't require rx and
tx MTU to be symmetric, with the likes of Acquire we could in theory
even assign a dedicated EATT channel if we have to.






[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux