Commit Graph

49 Commits

Author SHA1 Message Date
Scott Shawcroft
d2860b58b0
Check background pending before sleep
There is a race between when we run background tasks and when we
sleep. If an interrupt happens between the two, then we may delay
executing the background task. On some ports we checked this for
TinyUSB already. On iMX RT, we didn't which caused USB issues.
This PR makes it more generic for all background tasks including
USB.

Fixes #5086 and maybe others.
2021-08-19 12:18:13 -07:00
Jeff Epler
e1d7e46e88 fix keyboard interrupt 2021-06-18 11:15:51 -05:00
Dan Halbert
95cbf3faa5 handle CIRCUITPY_USB_CDC = 0 properly (fix simmel build) 2021-06-02 15:27:20 -04:00
Dan Halbert
3930440bc5 Fix usb_cdc.enable(console=False, data=True) 2021-06-02 11:29:56 -04:00
Scott Shawcroft
42f4065c8a
Merge remote-tracking branch 'adafruit/main' into merge_1.13 2021-05-06 11:17:53 -07:00
Scott Shawcroft
3fda0c0a1b
Fix board builds and use MP_ERROR_TEXT in py and extmod 2021-05-05 17:51:52 -07:00
Dan Halbert
f06d54524d merge from adafruit 2021-04-28 23:48:26 -04:00
Dan Halbert
587aedd14f rework storage allocation 2021-04-28 13:00:44 -04:00
Dan Halbert
8500e846c6 partially working 2021-04-27 23:53:23 -04:00
Dan Halbert
7a40b4daec very much WIP 2021-04-26 23:54:01 -04:00
Dan Halbert
c26e49c2e6 wip: starting to try to compile 2021-04-25 23:17:41 -04:00
Dan Halbert
2b4c88d633 wip: partial HID, still needs rework 2021-04-23 00:18:05 -04:00
Dan Halbert
64e0958916 wip: descriptor building 2021-04-21 23:25:36 -04:00
Dan Halbert
4a7e129287 wip: latent usb device enabling/disabling 2021-04-13 23:33:44 -04:00
microDev
a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Radomir Dopieralski
8c8d60fb80 Fix for CIRCUITPY_USB_MSC=0
Avoid undefined functions when MSC is disabled.
2021-02-27 15:05:00 +01:00
Jeff Epler
aa1de69645 fix length of generated serial number descriptor 2021-02-22 07:33:04 -06:00
Jeff Epler
144acfcb98 USB descriptors: Save flash storage for serial number
This saves about 60 bytes (Feather M4 went from 45040 -> 45100 bytes free)
66 bytes of data eliminated, but 6 bytes paid back to initialize the length
field.
2021-02-21 21:24:49 -06:00
Dan Halbert
e344c6d684 fix some builds 2021-02-18 14:24:58 -05:00
Dan Halbert
0b8f1b9a90 wip: usb_cdc.serials 2021-02-15 20:06:18 -05:00
Dan Halbert
5bb722b927
Merge pull request #4122 from hathach/fix-3986
Fix 3986 background reset remove existing usb callback
2021-02-05 09:13:28 -05:00
hathach
8d7b1f9e8c add usb_background_schedule()
unconditionally schedule usb background after
background_callback_reset()
2021-02-04 16:00:14 +07:00
Kevin Banks
215a56c920 Merge branch 'main' into webusb (trying to get CI back online) 2021-02-03 16:48:28 -06:00
hathach
e699a59890 hack to fix 3986
just a proof to show that issue analysis is correct
2021-02-03 11:01:33 +07:00
Kevin Banks
1b031508e1 BOS and MS_OS_2.0 descriptors have been added. Still more descriptor work TODO. 2021-01-26 20:43:19 -06:00
Kevin Banks
fbfb7b68cc Most of the code we need has been pulled in from the tinyusb webusb_serial demo. Still LOTS to do regarding descriptors. 2021-01-25 20:37:58 -06:00
Scott Shawcroft
b73b30ff9f
Switch to upstream TinyUSB 2021-01-21 11:33:13 -08:00
Dan Halbert
a0f1ec3c4a wip 2020-11-22 19:10:09 -05:00
Dan Halbert
39e1f52e28 wip; not compiling yet 2020-11-19 17:47:12 -05:00
Dan Halbert
bb77f1d130 wip: initial code changes, starting from @tannewt's sleepio branch 2020-11-16 11:56:20 -05:00
Dan Halbert
345d84ffde improve USB CDC disconnect/reconnect checking 2020-10-30 22:25:50 -04:00
Scott Shawcroft
9a4efed8cb
Start tweaking the workflow to sleep 2020-10-27 17:55:03 -07:00
Jeff Epler
28043c94b5 supervisor: Improve serial connection detection
These changes remove the caveat from supervisor.runtime.serial_connected.

It appears that _tud_cdc_connected() only tracks explicit changes to the
"DTR" bit, which leads to disconnects not being registered.

Instead:
 * when line state is changed explicitly, track the dtr value in
   _serial_connected
 * when the USB bus is suspended, set _serial_connected to False

Testing performed (using sam e54 xplained):  Run a program to show
the state of `serial_connected` on the LED:
```
import digitalio
import supervisor
import board

led = digitalio.DigitalInOut(board.LED)
while True:
    led.switch_to_output(not supervisor.runtime.serial_connected)
```

Try all the following:
 * open, close serial terminal program
    - LED status tracks whether terminal is open
 * turn on/off data lines using the switchable charge-only cable
    - LED turns off when switch is in "charger" position
    - LED turns back on when switch is in Data position and terminal is
      opened (but doesn't turn back on just because switch position is
      changed)
2020-09-17 18:32:06 -05:00
Scott Shawcroft
b76d37f24a
Merge pull request #3223 from dhalbert/unmount-before-reset
storage.erase_filesystem(): disconnect from USB and wait 1 second before resetting
2020-07-29 10:47:24 -07:00
Dan Halbert
65c22aa434 storage.erase_filesystem(): unmount and wait 1 second before resetting 2020-07-28 17:52:56 -04:00
Jeff Epler
9fd10322fe supervisor: rename some locals for clarity
It's perfectly OK for these variables with static linkage to have the
same name, but it's inconvenient for humans like me.
2020-07-20 08:45:31 -05:00
Jeff Epler
6160d11c5a supervisor: factor out, Handle USB via background callback 2020-07-15 11:49:44 -05:00
Scott Shawcroft
6aaab005c5
Initial ESP32S2 port.
Basic blinky works but doesn't check pins.
2020-05-15 15:36:16 -07:00
Scott Shawcroft
6f60afe8c5
First try at lowering the power consumption 2020-03-13 11:12:30 -07:00
Scott Shawcroft
561fdfb279
Improve USB eject by resetting on replug 2019-12-17 19:01:03 -08:00
Dan Halbert
91d791afd0 cleanup adapter.address; add uniquish suffix to BLE device name 2019-07-31 00:30:24 -04:00
Scott Shawcroft
796fc3f5ab
Update font location and shrink a bunch of builds 2019-04-12 15:25:48 -07:00
hathach
9d43a25d6e update tinyusb to fix disconnect/suspend issue with #1681 2019-04-04 17:59:20 -04:00
Lionel Debroux
943216deda Make several const char / const char * arrays static to save a bit of space.
Signed-off-by: Lionel Debroux <lionel_debroux@yahoo.fr>
2019-02-07 20:10:43 +01:00
hathach
a51f2b0716 refactor nrfx from supervisor/usb.c 2019-01-30 22:30:23 +07:00
hathach
164e1e2341 re-init usb hardware when enable/disable SD 2019-01-30 14:13:07 +07:00
hathach
d1fb384a4a
update tinyusb, work better with sd 2019-01-29 21:03:18 +07:00
Scott Shawcroft
b5e40f52c2
Add USB MIDI support for SAMD and nRF.
The API should be identical to using a UART for MIDI.

Fixes #672
2019-01-09 14:02:11 -08:00
Scott Shawcroft
9d91111b1b
Move atmel-samd to tinyusb and support nRF flash.
This started while adding USB MIDI support (and descriptor support is
in this change.) When seeing that I'd have to implement the MIDI class
logic twice, once for atmel-samd and once for nrf, I decided to refactor
the USB stack so its shared across ports. This has led to a number of
changes that remove items from the ports folder and move them into
supervisor.

Furthermore, we had external SPI flash support for nrf pending so I
factored out the connection between the usb stack and the flash API as
well. This PR also includes the QSPI support for nRF.
2018-11-08 17:25:30 -08:00