Wykres commitów

1548 Commity (master)

Autor SHA1 Wiadomość Data
Damien George 45ead11f96 ssl: Use "from tls import *" to be compatible with axtls.
axtls doesn't define all the CERT_xxx constants, nor the MBEDTLS_VERSION
constant.

This change means that `tls.SSLContext` is imported into the module, but
that's subsequently overridden by the class definition in this module.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-28 17:44:37 +11:00
iabdalkader 661efa48f0 senml: Use the updated cbor2 API.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-19 17:29:22 +11:00
iabdalkader 8ee876dcd6 cbor2: Deprecate decoder and encoder modules.
Deprecate decoder and encoder modules to maintain compatibility with the
CPython cbor2 module.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-19 17:28:35 +11:00
Jim Mussared 5c7e3fc0bc json: Move to unix-ffi.
It requires the unix pcre-based re module.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2024-03-19 17:23:07 +11:00
Damien George 23df50d0ea unix-ffi: Remove "unix_ffi" argument from require().
And describe how to use `add_library()` instead.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-17 13:22:36 +11:00
Damien George ffb07dbce5 gzip: Fix recursion error in open() function.
And give the `mode` parameter a default, matching CPython.

Signed-off-by: Damien George <damien@micropython.org>
2024-02-29 14:54:24 +11:00
Angus Gratton 224246531e lora-sx126x: Clean up some struct formatting.
Changes are cosmetic - and maybe very minor code size - but not functional.
_reg_read() was calling struct.packinto() with an incorrect number of
arguments but it seems like MicroPython didn't mind, as result is correct
for both versions.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:58:38 +11:00
Angus Gratton 35bb7952ba lora-sx126x: Fix syncword setting.
Fixes issue #796.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:58:08 +11:00
Angus Gratton 546284817a lora-sx127x: Implement missing syncword support.
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:58:06 +11:00
Angus Gratton ad6ab5a78c lora-sync: Fix race with fast or failed send().
If send completes before the first call to poll_send(), the driver could
get stuck in _sync_wait(). This had much less impact before rp2 port went
tickless, as _sync_wait(will_irq=True) calls machine.idle() which may not
wake very frequently on a tickless port.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:57:50 +11:00
Angus Gratton b712103519 lora-sx126x: Fix invalid default configuration after reset.
According to the docs, only freq_khz was needed for working output.
However:

- Without output_power setting, no output from SX1262 antenna (theory:
  output routed to the SX1261 antenna).

- SF,BW,etc. settings were different from the SX127x power on defaults, so
  modems with an identical configuration were unable to communicate.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:44:57 +11:00
Angus Gratton 4cc67065dd tools/ci.sh: Add unix-ffi library when testing unix-ffi subdirectory.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-19 23:21:04 +11:00
ubi de feo 8058b2935b tarfile-write: Fix permissions when adding to archive.
Signed-off-by: ubi de feo <me@ubidefeo.com>
2024-02-09 10:43:05 +11:00
Carlosgg 56f514f569 aiohttp: Fix binary data treatment.
- Fix binary data `Content-type` header and data `Content-Length`
  calculation.

- Fix query length when data is included.

- Fix `json` and `text` methods of `ClientResponse` to read
  `Content-Length` size

Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2024-02-08 19:02:26 +11:00
Adam Knowles ddb1a27957 hmac: Fix passing in a string for digestmod argument.
The built-in `hashlib` module does not have a `.new` method (although the
Python version in this repository does).
2024-02-07 12:45:03 +11:00
Felix Dörre 35d41dbb0e ssl: Restructure micropython SSL interface to a new tls module.
MicroPython now supplies SSL/TLS functionality in a new built-in `tls`
module.  The `ssl` module is now implemented purely in Python, in this
repository.  Other libraries are updated to work with this scheme.

Signed-off-by: Felix Dörre <felix@dogcraft.de>
2024-02-07 12:12:13 +11:00
Felix Dörre 803452a1ac umqtt.simple: Simplify check for user being unused.
There don't seem to be any MQTT implementations that expect an empty
username (instead of the field missing), so the check for unused `user` can
be simplified.

Signed-off-by: Felix Dörre <felix@dogcraft.de>
2024-02-07 12:12:09 +11:00
Carlosgg 7cdf708815 aiohttp: Add new aiohttp package.
Implement `aiohttp` with `ClientSession`, websockets and `SSLContext`
support.

Only client is implemented and API is mostly compatible with CPython
`aiohttp`.

Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2023-12-20 16:26:04 +11:00
Bhavesh Kakwani 57ce3ba95c aioble: Fix advertising variable name to use us not ms. 2023-12-20 15:22:21 +11:00
Mark Blakeney 9ceda53180 uaiohttpclient: Update example client code.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:56:09 +11:00
Mark Blakeney 05efdd03a7 uaiohttpclient: Update "yield from" to "await".
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:56:04 +11:00
Mark Blakeney 9d09cdd4af uaiohttpclient: Make flake8 inspired improvements.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:56:00 +11:00
Mark Blakeney 149226d3f7 uaiohttpclient: Fix hard coded port 80.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:55:51 +11:00
scivision ae8ea8d113 os-path: Implement os.path.isfile().
Signed-off-by: Michael Hirsch <michael@scivision.dev>
2023-12-20 14:46:57 +11:00
Andrew Leech f672baa92b aiorepl: Add support for raw mode (ctrl-a).
Provides support for mpremote features like cp and mount.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:35:40 +11:00
Andrew Leech 10c9281dad aiorepl: Add cursor left/right support.
Allows modifying current line, adding/deleting characters in the middle
etc.  Includes home/end keys to move to start/end of current line.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:33:43 +11:00
Andrew Leech d41851ca72 aiorepl: Add support for paste mode (ctrl-e).
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:33:19 +11:00
Andrew Leech e051a120bc aiorepl: Update import of asyncio.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:33:16 +11:00
Yu Ting 41aa257a31 base64: Implement custom maketrans and translate methods.
Re-implemented bytes.maketrans() and bytes.translate() as there are no such
functions in MicroPython.
2023-12-20 12:26:13 +11:00
Matt Trentini 340243e205 time: Add README to explain the purpose of the time extension library.
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
2023-12-20 12:05:35 +11:00
Jim Mussared 83f3991f41 lcd160cr: Remove support for options in manifest.
This is the last remaining use of the "options" feature. Nothing in the
main repo which `require()`'s this package sets it.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 12:01:22 +11:00
Jim Mussared cee0945f1c all: Replace "black" with "ruff format".
- Add config for [tool.ruff.format] to pyproject.toml.
- Update pre-commit to run both ruff and ruff-format.
- Update a small number of files that change with ruff's rules.
- Update CI.
- Simplify codeformat.py just forward directly to "ruff format"

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 11:56:24 +11:00
Jim Mussared ad0a2590cc tools/verifygitlog.py: Add git commit message checking.
This adds verifygitlog.py from the main repo, adds it to GitHub workflows,
and also pre-commit.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 11:46:40 +11:00
Christian Marangi d8e163bb5f unix-ffi/re: Convert to PCRE2.
PCRE is marked as EOL and won't receive any new security update.

Convert the re module to PCRE2 API to enforce security.  Additional
dependency is now needed with uctypes due to changes in how PCRE2 return
the match_data in a pointer and require special handling.

The converted module is tested with the test_re.py with no regression.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-11-01 10:14:36 +11:00
Jim Mussared 0620d02290 .github/workflows/ruff.yml: Pin to 0.1.0.
The `--format` flag was changed to `--output-format` in the recent update.

Pin to this version to prevent further updates from breaking (e.g. through new rules or other changes).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-26 11:48:26 +11:00
Brian Whitman e025c843b6 requests: Fix detection of iterators in chunked data requests.
Chunked detection does not work as generators never have an `__iter__`
attribute.  They do have `__next__`.

Example that now works with this commit:

    def read_in_chunks(file_object, chunk_size=4096):
        while True:
            data = file_object.read(chunk_size)
            if not data:
                break
            yield data

    file = open(filename, "rb")
    r = requests.post(url, data=read_in_chunks(file))
2023-10-05 10:42:14 +11:00
Jim Mussared 46748d2817 aioble/server.py: Allow BufferedCharacteristic to support all ops.
Previously a BufferedCharacteristic could only be read by the client, where
it should have been writeable. This makes it support all ops (read / write
/ write-with-response, etc).

Adds a test to check the max_len and append functionality of
BufferedCharacteristic.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-04 14:47:38 +11:00
Jim Mussared e5ba864470 aioble/server.py: Add data arg for indicate.
In micropython/micropython#11239 we added support for passing data to
gatts_indicate (to make it match gatts_notify).

This adds the same to aioble.

Also update the documentation to mention this (and fix some mistakes and
add a few more examples).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-04 14:37:26 +11:00
Matthias Urlichs 55d1d23d6f __future__: Add "annotations".
MicroPython ignores types anyway.
2023-10-04 12:53:52 +11:00
Damien George e6b89eafa3 all: Remove unnecessary start argument in range.
To satisfy Ruff.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-01 00:17:28 +10:00
Angus Gratton 7fcc728db2 lora/sx126x: Fix busy timeout handling.
- If no reset pin was set, calling standby() in the constructor
  would enable the TCXO (XOSC) before the timeout was correctly set.

- This manifested as a BUSY timeout on the STM32WL5, first time after power
on reset.

- Clean up the general handling of BUSY timeouts, but also add some safety
margin to the base timeout just in case (not an issue, is only a stop-gap
to prevent the modem blocking indefinitely.)

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:37 +10:00
Angus Gratton 0bdecbcba1 lora: Note known issue with STM32WL5 HP antenna.
For unknown reason, power output in this configuration is lower than it
should be (including when compared to the STM32Cube C libraries running on
the same board.

Suspect either the Nucleo board antenna switch or the power amplifier
registers are being set wrong, but the actual root cause remains elusive...

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:25 +10:00
Angus Gratton ed688cf019 lora: Add STM32WL55 subghz LoRa modem class.
Support depends on hardware support in MicroPython.

Also includes some tweaks in the SX126x base class, to deal with slightly
different platform configuration on STM32WL55, longer timeouts, tx_ant
options, etc.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:04 +10:00
Angus Gratton 93bf707d6f lora: Remove the pin parameter from IRQ callback.
It's not necessary to know which pin triggered the IRQ, and it saves some
code size.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-23 11:42:59 +10:00
Damien George dc765ad822 wm8960: Bump patch version.
For changes in 1f3002b537.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-23 11:42:00 +10:00
Damien George 1b557eee5c lsm6dsox: Bump patch version.
For changes in 2d16f210b9.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-23 11:41:22 +10:00
Angus Gratton 5b6fb2bc56 top: Enable Ruff linter to check undefined-name (F821).
Also adds some global ignores for manifest files (which have implicit
imports) and the multitests (which have the same).

Other F821 fixes or accommodations are in the parent commits to this
commit.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:44:01 +10:00
Angus Gratton b46306cc5a uaiohttpclient: Fix missing name in unreachable example code.
As-written this code is unreachable (return statement two line above),
so this change is really just to make the linter happy.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:51 +10:00
Angus Gratton 991ac986fd iperf3: Pre-declare some variables set in the loop.
This is a change just to make the linter happy, the code
probably would have run OK without it.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:46 +10:00
Angus Gratton c6a72c70b9 cbor2: Improve decoder to pass Ruff F821 undefined-name.
These were probably intentional missing names, however raising
NotImplementedError or KeyError is more explicit than trying to call an
unknown function.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:20 +10:00