Skip to content

Disconnect when restarting HID example; provide default HID descriptor #56

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

Merged
merged 2 commits into from
Jan 21, 2020

Conversation

dhalbert
Copy link
Collaborator

A connection doesn't re-pair properly if this example is restarted and the peer thinks the connection is still ongoing. So this change closes all connections first.

@tannewt I'm not sure this is the best solution, but I'm not sure it's possible to know which connection is the "right" one to close. Also, would this close the CircuitPython service connection, or is that hidden?

Also I removed setting the complete name, but this is a matter of taste. It doesn't always appear in lists of devices to pair: sometimes one sees a cached name. It depends on the OS.

@dhalbert dhalbert requested a review from tannewt January 14, 2020 22:57
@dhalbert dhalbert changed the title Disconnect when restarting HID example Disconnect when restarting HID example; provide default HID descriptor Jan 17, 2020
@dhalbert
Copy link
Collaborator Author

@tannewt I moved the big HID descriptor out of the example and into hid.py as a default descriptor. That could probably be improved (like selecting which devices you want), but it's good for now, and it makes example code and Guide code simpler.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for moving the descriptor! What do you thinking about moving it to the HID library instead? It's really coupled to that rather than BLE.

@dhalbert
Copy link
Collaborator Author

dhalbert commented Jan 21, 2020

I think it's a good idea in the long run to move the descriptor, but I'm a bit worried about increasing the size of the frozen HID library. Could we do that as a longer-term goal? If we merge this PR now then we can publish JP's BLE HID guide right away.

(It could be done this week, or later. I just want the libraries to be sync'd up to the Learn Guide.)

@TheKitty
Copy link
Contributor

Per Dan, merging now and the descriptor move will be considered in a later revision

@TheKitty TheKitty merged commit bad77d0 into adafruit:master Jan 21, 2020
@dhalbert dhalbert deleted the update-hid-for-bonding branch January 21, 2020 20:06
@tannewt
Copy link
Member

tannewt commented Jan 22, 2020

@TheKitty Please don't merge if I've asked something and not done it myself. I may have another solution. Please ping me instead.

For now, this is ok. I'll think on where it should go.

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 22, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_ADXL34x to 1.10.4 from 1.10.3:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#15 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#14 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#13 from kattni/readme-update
  > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#12 from kattni/update-all-examples
  > Merge pull request adafruit/Adafruit_CircuitPython_ADXL34x#11 from kattni/add-adxl345-example-code

Updating https://github.com/adafruit/Adafruit_CircuitPython_AMG88xx to 1.1.6 from 1.1.5:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_AMG88xx#22 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_ATECC to 1.0.4 from 1.0.3:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_ATECC#8 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_CCS811 to 1.1.7 from 1.1.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_CCS811#38 from linusg/patch-1
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_CCS811#36 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_CCS811#35 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_CharLCD to 3.2.2 from 3.2.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#44 from caternuson/iss38
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#43 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_CharLCD#42 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306 to 1.1.3 from 1.1.2:
  > update pylint examples directive
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306#8 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306#6 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_DRV2605 to 1.0.4 from 1.0.3:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_DRV2605#18 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_DRV2605#17 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_HX8357 to 1.1.2 from 1.1.1:
  > update pylint examples directive
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_HX8357#7 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_HX8357#6 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_INA219 to 3.3.1 from 3.3.0:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_INA219#15 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP3xxx to 1.3.0 from 1.1.2:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_MCP3xxx#22 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_MCP3xxx#20 from 2bndy5/mcp3002-support
  > Merge pull request adafruit/Adafruit_CircuitPython_MCP3xxx#19 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_MPR121 to 2.0.5 from 2.0.4:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_MPR121#22 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_MPR121#21 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_MSA301 to 1.1.1 from 1.1.0:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_MSA301#3 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_MSA301#2 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_Nunchuk to 0.1.2 from 0.1.1:
  > update pylint examples directive
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_Nunchuk#7 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_Nunchuk#6 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_PN532 to 2.0.9 from 2.0.8:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_PN532#29 from basil-huber/spi_buffer_fix
  > Merge pull request adafruit/Adafruit_CircuitPython_PN532#27 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_PN532#26 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_RFM9x to 1.2.1 from 1.2.0:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_RFM9x#35 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_SGP30 to 2.1.2 from 2.1.1:
  > update pylint examples directive

Updating https://github.com/adafruit/Adafruit_CircuitPython_TLV493D to 1.0.1 from 1.0.0:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_TLV493D#2 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_TLV493D#1 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_TSL2591 to 1.1.4 from 1.1.3:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_TSL2591#12 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_TSL2591#11 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_VS1053 to 1.1.2 from 1.1.1:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_VS1053#6 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_VS1053#5 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_GC_IOT_Core to 1.0.2 from 1.0.1:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_GC_IOT_Core#6 from brentru/pypi-setup
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_GC_IOT_Core#5 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_GC_IOT_Core#4 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT to 1.0.3 from 1.0.2:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#6 from brentru/pypi-setup
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#5 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#4 from adafruit/dherrada-patch-1-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_binascii to 1.0.2 from 1.0.1:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_binascii#5 from brentru/pypi
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_binascii#4 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_binascii#3 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE to 5.0.2 from 4.0.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#64 from tannewt/fix_packaging
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#58 from dglaude/patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#56 from dhalbert/update-hid-for-bonding
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#63 from dhalbert/fix-lazy-advertising-fields
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE#61 from adafruit/dherrada-patch-3

Updating https://github.com/adafruit/Adafruit_CircuitPython_BoardTest to 1.1.2 from 1.1.1:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_BoardTest#9 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_JWT to 1.0.1 from 1.0.0:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_JWT#4 from brentru/pypi-setup
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_JWT#3 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_JWT#2 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_Logging to 1.1.1 from 1.1.0:
  > update pylint examples directive
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_Logging#8 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_Logging#7 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_Logging#6 from magnusvmt/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_PYOA to 2.1.1 from 2.1.0:
  > update pylint examples directive
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_PYOA#17 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_RSA to 1.0.3 from 1.0.2:
  > update pylint examples directive
  > Merge pull request adafruit/Adafruit_CircuitPython_RSA#7 from brentru/pypi
  > disabling pypi deploy via actions
  > Merge pull request adafruit/Adafruit_CircuitPython_RSA#6 from adafruit/dherrada-patch-1
  > Merge pull request adafruit/Adafruit_CircuitPython_RSA#5 from adafruit/dherrada-patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_GC_IOT_Core, Adafruit_CircuitPython_AzureIoT, Adafruit_CircuitPython_binascii, Adafruit_CircuitPython_JWT, Adafruit_CircuitPython_Pypixelbuf, Adafruit_CircuitPython_RSA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants