Fetch the current usb mode and return a string representation when
pyb.usb_mode() is called with no args. The possible string values are interned
as qstr's. None will be returned if an incorrect mode is set.
When setting usb_mode to "HID", hid config object now has
polling-interval (in ms) as the 4th element. It mmust now be a 5-tuple
of the form:
(subclass, protocol, max_packet_len, polling_interval, report_desc)
The mouse and keyboard defaults have polling interval at 8ms.
Apparently the order of interface numbers should be sequential and
increasing in a config descriptor. So as to retain compatibility with
Windows drivers for the CDC+MSC and CDC+HID modes, we move the CDC
configs to the end of the descriptors, instead of changing the interface
numbers.
See PR #957 for background.
By measuring SD card addresses in blocks and not bytes, one can get away
with using 32-bit numbers.
This patch also uses proper atomic lock/unlock around SD card
read/write, adds SD.info() function, and gives error code for failed
read/writes.
Internal flash used for the filesystem is now written (from the cache)
only after a 5s delay, or when a file is closed, or when the drive is
unmounted from the host. This delay means that multiple writes can
accumulate in the cache, and leads to less writes to the flash, making
it last longer.
It's implemented by a high-priority interrupt that takes care of flash
erase and write, and flushing the cache.
This is still only an interim solution for the flash filesystem. It
eventually needs to be replaced with something that uses less RAM for
the cache, something that can use more of the flash, and something that
does proper wear levelling.
Mac OS X sends a SCSI command to remove the medium when it unmounts a
drive. If this command is not honoured, then OS X will automatically
remount the drive, making it impossible to eject. This patch disables
the USB MSC when the right SCSI command is sent.
Can now choose at boot up whether the USB device is CDC+MSC or CDC+HID.
Choice is made by an option in boot.py, with default being CDC+MSC.
HID+MSC is not currently supported, but should be easy to implement.
Boot up now has ability to change the reset mode: hold down USR switch
while booting and LEDs will count from 1 to 7 to indicate the boot mode.
Release USR when correct mode is selected. Current modes are 1 (normal
boot), 2 (safe mode), 3 (reset FS mode).