This reverts commit 7e6e824d56.
Fixes#7770
The change in #7623 needs to be revered; the raise-site added in #7632
is the correct one and the one in socketpool needs to be reverted.
This is not affecting 8.0.x because #7623 was not back-ported to there
before we realized it was not a full fix.
Both #7770 and #7606 should be re-tested. I didn't test.
It now handles deinit, never_reset and sharing tracking. PWM
now runs in the WAIT state as well during a time.sleep().
_reset_ok() was removed because it was called in one spot right
before deinit().
Some PWMOut were also switched to a bitmap for use instead of
reference count. That way init and deinit are idempotent.
Fixes#6589. Fixes#4841. Fixes#4541.
Rather than returning the negative error value.
This is intended to close#7606, though I did not test with mqtt.
Instead, I created a simple standalone test program:
```python
import wifi, socketpool, ssl, time
#wifi.radio.connect(<omitted>)
import socketpool
socket = socketpool.SocketPool(wifi.radio)
ctx = ssl.create_default_context()
b = bytearray(8)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sss = ctx.wrap_socket(s, server_hostname='example.com')
sss.connect(('example.com', 443))
sss.setblocking(False)
r = sss.recv_into(b)
print(r, b) # prints 4294967285 which is -11 as unsigned
sss.close()
```
Before the change, r was the out of range value 4294967285. After the
change, the recv_into call raises OSError instead.
This is comparable to the behavior on standard Python, though an
SSLWantReadError is raised instead.
The original (mis)behavior seems to match what was uncovered deep inside
minimqtt by adding logging:
```
370.578: DEBUG - PKT: _sock_exact_recv: recv_len = 4294967285
```
Watchdogs are used to reboot out of the bootloader. There is a
scratch register for user watchdogs. So use sdk functions to better
distinguish these.
Related to #7346
Now, open wifi works on Pico W, so this closes#7438.
For the web workflow it's now OK to either
* specify an empty password string (as before)
* not have the CIRCUITPY_WIFI_PASSWORD key at all (new functionality)
* read() is now readinto() and takes the buffer to write into.
* readinto() returns the number of valid samples.
* readinto() can be interrupted by ctrl-c.
* readinto() API doesn't support signed numbers because it never did.
* sample_rate is now required in the constructor because supported
values will vary per-port.
* 16 bit values are full range. 12 bit samples from RP2040 are stretched
in the same way they are for AnalogIn.
Fixes#7226