./build.sh sim:usbdev -j12
sudo gdb nuttx/nuttx -ex "source nuttx/tools/gdb/__init__.py"
below command to create mbim NIC on host
nsh> conn 3
NuttX's MBIM device implementation adds an additional MBIM network
card to the NuttX system, which can debug the data communication with
the host, but this network card is unnecessary and needs to be removed
when the business actually uses this driver, And the cdcncm_receive
method needs to be re-implemented.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
optimize the interaction flow associated with network drivers to reduce
the amount of code and improve compatibility
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Previously CONFIG_USBDEV_SOFINTERRUPT existed in many platform
drivers but did nothing. This commit adds a callback function
usbdev_sof_irq() that can be used to take action on this interrupt.
Add usb_fs driver so that userspace can directly transfer USB packets
through the EP node. ADB, Fastboot, MTP will use usb_fs, these class
driver only need to provide the descriptors and register the usb_fs device.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
A usbdev has only one serial string, so use a unique macro to control it.
For boards that enable board serial string using COMPOSITE_BOARD_SERIALSTR,
PL2303_BOARD_SERIALSTR, CDCACM_BOARD_SERIALSTR, USBADB_BOARD_SERIALSTR,
USBMSC_BOARD_SERIALSTR, and RNDIS_BOARD_SERIALSTR, they need to be replaced
with BOARD_USBDEV_SERIALSTR.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Add COMPOSITE_DEVICES configuration so that external composite
devices can also know the maximum number of supported classes.
The default COMPOSITE_DEVICES number is 8.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This patch introduces a configuration option USBMSC_WRMULTIPLE,
which is used to store multiple blocks into a larger chunk that
then gets written via the mmcsd_writemultiple() (in case mmcsd
is used).
The bottleneck with the current implementation is the poor
performance due to short block writes. USBMSC_DRVR_WRITE()
always writes only one sector (with eMMC that's usually 512 bytes).
eMMC devices usually erase much larger regions with near constant
time (see Jedec JESD84-B51, Extended CSD register byte [225],
SUPER_PAGE_SIZE): 'This register defines one or multiple of
programmable boundary unit that is programmed at the same time.'
If USBMSC_WRMULTIPLE is defined, then USBMSC_NWRREQS is used to
allocate the write buffer size. We don't want this to be the
default behavior yet as this may reveal unseen bugs in usb drivers
due to the faster overall performance.
Sample configurations with measured performance:
- Without USBMSC_WRMULTIPLE: 470 Kb/s
- With USBMSC_WRMULTIPLE, CONFIG_USBMSC_NWRREQS=4: 1.1 Mb/s
(dd with bs=2k)
- With USBMSC_WRMULTIPLE, CONFIG_USBMSC_NWRREQS=16: 5.2 Mb/s
(dd with bs=8k)
No doubt, this feature alone may make the mass storage work 10
times faster than before with eMMC cards.
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
usbmsc.h uses the CONFIG_USBMSC_IFNOBASE configuration option,
but it cannot be set anywhere. Provide means to configure this
option which is useful when it's other than the default zero.
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
iSerialNumber field in the device descriptor can be used to determining the
board when multiple boards connected to the same host. So add feature to change
serial string by board unique ID dynamically.
To use this feature, user must be implement the board_usbdev_serialstr() logic.
refs #13909
The new configuration CONFIG_USBMSC_NOT_STALL_BULKEP avoids to go into
stall state when :
- Receiving SCSI_CMD_INQUIRY with flags or pagecode != 0
- Receiving SCSI_CMD_MODESENSE6 and return the result data shorter than
the requested data size.
Instead of stall, it just ignores the error condition.
Originally the usb driver goes into the stall under the conditions
mentioned above to inform to the USB host that the requested SCSI feature
is not supported, or the result data is shorter than the requested data
size.
But, at this moment, RP2040 USB device driver cannot handle entering and
leaving stall state of the bulk endpoints well. Once stalls, the host -
device communication stops and cannot be resumed.
I have investigated to solve the issue and found that the existing
RP2040 USB device driver implementation, TinyUSB
(https://github.com/hathach/tinyusb) mass-storage class driver doesn't
enter the stall state like the treatment of this patch.
So, I introduce this new configuration as the RP2040 workaround.
In the future, when the RP2040 USB device driver is fixed and can handle
the bulk endpoint stall correctly, this patch should be reverted.
Summary:
- Change default value for RNDIS_NWRREQS based on NET_TCP_WRITE_BUFFERS
Impact:
- This commit affects RNDIS use cases
Testing:
- spresense:rndis with CONFIG_NET_TCP_WRITE_BUFFERS=y
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit does two things:
1. First, it reorganizes the driver Kconfig files so that each is self contained. Before, a part of the driver configuration was in drivers/Kconfig and the rest was in in drivers/xyz/Konfig. Now, all of the driver configuration is consolitated in the latter.
2. Second, this commit correct numerous serious errors introduced in a previous reorganization of the driver Kconfig files. This was first noted by Nicholas Chin in PR270 for the case of the drivers/i2c/Kconfig but some examination indicates that the error was introduced into several other Kconfig files as well.
The nature of the introduced error was basically this:
- Nothing must intervene between the menuconfig selection and the following conditional configuration otpions.
- A previous PR erroneously introduced unconditional options between the menuconfig and the following confditional logic, thus corrupting the driver menus.
This error was easy to make because the driver Kconfig files were not well modularized. Making them fully self-contained should eliminate this kind of error in the future.
Initial OTG support for STM32H7 and some minor improvements
arch/arm/src/stm32h7/stm32h7x3xx_rcc.c: add support for HSI48 clock
configs/nucleo-f207zg: add support for USB and initialize CDCACM if configured
configs/nucleo-h743zi: add support for USB and initialize CDCACM if configured
drivers/usbdev/Kconfig: fix type for USBDEV_TRACE_INITIALIDSET
configs/teensy-3.x/usbnsh/defconfig: update config according to change in USBDEV_TRACE_INITIALIDSET
Approved-by: Gregory Nutt <gnutt@nuttx.org>
RNDIS composite support
* NuttX usb/composite.h: Forward-declare composite_devdesc_s.
This avoids "error: conflicting types for 'composite_initialize'"
on some versions of GCC. Because of the cross-inclusion between
usbdev.h and composite.h, the full declaration is not always
available.
* NuttX: USB Composite driver: Fix strid comparison
The last string ID used by composite driver is 4, and
the number of IDs used is 5 (0..4). The comparison
strid <= COMPOSITE_NSTRIDS caused composite driver to
reply with -EINVAL for id 5, even though it should be
available for subdevices to use.
* NuttX: RNDIS USB driver: Add support for composite configuration.
Approved-by: GregoryN <gnutt@nuttx.org>
These Microsoft-only descriptors help in loading the correct driver on Windows.
They are especially helpful to give libusb access to a custom device without
having to manually configure/install WinUSB driver.
With this change DFU interface works automatically on
Windows 10 with dfu-util 0.9 and libusb 1.0.22. On Windows 7
it still appears to need driver installation.