<feed xmlns='http://www.w3.org/2005/Atom'>
<title>openmano-mpy/extmod/nimble, branch master</title>
<subtitle>MicroPython source and hardware configuration for OpenMano</subtitle>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/'/>
<entry>
<title>extmod/modbluetooth: Separate enabling of "client" from "central".</title>
<updated>2021-02-19T06:53:43+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2021-02-19T03:47:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=a76604afba109d990e466cdcd5a69a82077a7f56'/>
<id>a76604afba109d990e466cdcd5a69a82077a7f56</id>
<content type='text'>
Previously, the MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE macro
controlled enabling both the central mode and the GATT client
functionality (because usually the two go together).

This commits adds a new MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
macro that separately enables the GATT client functionality.
This defaults to MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE.

This also fixes a bug in the NimBLE bindings where a notification
or indication would not be received by a peripheral (acting as client)
as gap_event_cb wasn't handling it. Now both central_gap_event_cb
and peripheral_gap_event_cb share the same common handler for these
events.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, the MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE macro
controlled enabling both the central mode and the GATT client
functionality (because usually the two go together).

This commits adds a new MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
macro that separately enables the GATT client functionality.
This defaults to MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE.

This also fixes a bug in the NimBLE bindings where a notification
or indication would not be received by a peripheral (acting as client)
as gap_event_cb wasn't handling it. Now both central_gap_event_cb
and peripheral_gap_event_cb share the same common handler for these
events.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/modbluetooth: Allow NimBLE to use Zephyr static address.</title>
<updated>2021-02-17T00:25:02+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2021-02-12T03:33:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=4005138882757ae536482c1d105b28c9869ab8ce'/>
<id>4005138882757ae536482c1d105b28c9869ab8ce</id>
<content type='text'>
Zephyr controllers can be queried for a static address (computed from the
device ID).  BlueKitchen already supports this, but make them both use the
same macro to enable the feature.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Zephyr controllers can be queried for a static address (computed from the
device ID).  BlueKitchen already supports this, but make them both use the
same macro to enable the feature.
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/nimble/hal/hal_uart: Fix HCI_TRACE format specifiers.</title>
<updated>2021-02-17T00:24:48+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2021-02-12T03:31:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=236274f08fb51d36eba9cd0458483bd398bfed0a'/>
<id>236274f08fb51d36eba9cd0458483bd398bfed0a</id>
<content type='text'>
Makes this work consistently on unix and stm32 ports.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Makes this work consistently on unix and stm32 ports.
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/nimble: Ensure handle is set on read error.</title>
<updated>2021-02-16T03:57:10+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2021-02-12T02:25:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=a1a28157993756255eca067acb23145b08151546'/>
<id>a1a28157993756255eca067acb23145b08151546</id>
<content type='text'>
On error, the handle is only available on err-&gt;att_handle rather than
in attr-&gt;handle used in the non-error case.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On error, the handle is only available on err-&gt;att_handle rather than
in attr-&gt;handle used in the non-error case.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/nimble: Improve the flow control for l2cap recv path.</title>
<updated>2021-01-30T02:22:40+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2021-01-29T06:46:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=47d02b3104369430db9fd7a6f80f9fa47badaf65'/>
<id>47d02b3104369430db9fd7a6f80f9fa47badaf65</id>
<content type='text'>
If the _IRQ_L2CAP_RECV handler does the actual consumption of the incoming
data (i.e. via l2cap_recvinto), rather than setting a flag for
non-scheduler-context to handle it later, then two things can happen:

- It can starve the VM (i.e. the scheduled task never terminates).  This is
  because calling l2cap_recvinto will empty the rx buffer, which will grant
  more credits to the channel (an HCI command), meaning more data can
  arrive.  This means that the loop in hal_uart.c that keeps reading HCI
  data from the uart and executing NimBLE events as they are created will
  not terminate, preventing other VM code from running.

- There's no flow control (i.e. data will arrive too quickly).  The channel
  shouldn't be given credits until after we return from scheduler context.

It's preferable that no work is done in scheduler/IRQ context.  But to
prevent this being a problem this commit changes l2cap_recvinto so that if
it is called in IRQ context, and the Python handler empties the rx buffer,
then don't grant credits until the Python handler is complete.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the _IRQ_L2CAP_RECV handler does the actual consumption of the incoming
data (i.e. via l2cap_recvinto), rather than setting a flag for
non-scheduler-context to handle it later, then two things can happen:

- It can starve the VM (i.e. the scheduled task never terminates).  This is
  because calling l2cap_recvinto will empty the rx buffer, which will grant
  more credits to the channel (an HCI command), meaning more data can
  arrive.  This means that the loop in hal_uart.c that keeps reading HCI
  data from the uart and executing NimBLE events as they are created will
  not terminate, preventing other VM code from running.

- There's no flow control (i.e. data will arrive too quickly).  The channel
  shouldn't be given credits until after we return from scheduler context.

It's preferable that no work is done in scheduler/IRQ context.  But to
prevent this being a problem this commit changes l2cap_recvinto so that if
it is called in IRQ context, and the Python handler empties the rx buffer,
then don't grant credits until the Python handler is complete.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/modbluetooth: Add ble.hci_cmd(ogf, ocf, req, resp) function.</title>
<updated>2021-01-22T07:15:12+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2021-01-22T06:30:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=aa136b4d78c7f81e63bde20ae17ab69bbbf456db'/>
<id>aa136b4d78c7f81e63bde20ae17ab69bbbf456db</id>
<content type='text'>
This allows sending arbitrary HCI commands and getting the response.  The
return value of the function is the status of the command.

This is intended for debugging and not to be a part of the public API, and
must be enabled via mpconfigboard.h.  It's currently only implemented for
NimBLE bindings.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This allows sending arbitrary HCI commands and getting the response.  The
return value of the function is the status of the command.

This is intended for debugging and not to be a part of the public API, and
must be enabled via mpconfigboard.h.  It's currently only implemented for
NimBLE bindings.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/nimble: Don't assert on save-IRK failure.</title>
<updated>2020-12-22T23:08:00+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2020-12-22T02:06:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=f7aafc0628f2008d015b32b0c0253a13f748d436'/>
<id>f7aafc0628f2008d015b32b0c0253a13f748d436</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/nimble: Reset NimBLE BSS in mp_bluetooth_init.</title>
<updated>2020-12-22T23:07:49+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2020-12-21T06:31:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=f42a190247661e1e5aa18e0ce93c627fd7676d8e'/>
<id>f42a190247661e1e5aa18e0ce93c627fd7676d8e</id>
<content type='text'>
Without this fix, each time service registration happened it would do an
increasingly large malloc() for service state.

See https://github.com/apache/mynewt-nimble/issues/896.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Without this fix, each time service registration happened it would do an
increasingly large malloc() for service state.

See https://github.com/apache/mynewt-nimble/issues/896.
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/nimble: Generate and persist a unique IRK.</title>
<updated>2020-12-02T03:44:39+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2020-11-27T06:08:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=d79b9c6c7cb42c69c15d1b7869a04e889d812b82'/>
<id>d79b9c6c7cb42c69c15d1b7869a04e889d812b82</id>
<content type='text'>
This provides a workaround for
https://github.com/apache/mynewt-nimble/issues/887.

Without this, all devices would share a fixed default IRK.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This provides a workaround for
https://github.com/apache/mynewt-nimble/issues/887.

Without this, all devices would share a fixed default IRK.

Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>extmod/modbluetooth: Add support for passkey authentication.</title>
<updated>2020-12-02T03:43:32+00:00</updated>
<author>
<name>Jim Mussared</name>
</author>
<published>2020-11-26T12:49:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.0x7felf.com/openmano-mpy/commit/?id=e4f27cbee767d24f8e05678a484a584ec6fbe974'/>
<id>e4f27cbee767d24f8e05678a484a584ec6fbe974</id>
<content type='text'>
Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Jim Mussared &lt;jim.mussared@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
