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>
The class device only handles descriptor information specific to the class,
and shared descriptor information is passed through parameters and
handled by the composite driver.
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>
In class disconnect, resetconfig will be performed based on
configid, so configid should be cleared after disconnect.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
Description bMS_VendorCode is incorrectly configured. Change it to
USB_REQ_GETMSFTOSDESCRIPTOR(0xee), which is the same as the request
processing logic for GET_MS_DESCRIPTOR in the code
Signed-off-by: sunkun3 <sunkun3@xiaomi.com>
In usbclass_unbind, DEV_FREEEP is called first, and later
usbclass_freereq does not free memory due to ep NULL
Signed-off-by: sunkun3 <sunkun3@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>
The enumeration process for composite and non-composite devices
has a lot of duplicate code. Treating the code for composite
devices as universal enumeration code can reduce redundant code.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
when the size of the usb configuration descriptor
is a multiple of 64 integers, only for this size less than wlength,
host do need send ZLP
Signed-off-by: sunkun3 <sunkun3@xiaomi.com>
config value changed after resetconfig was executed
endpoint will stay disable state after setinterface cmd
Signed-off-by: sunkun3 <sunkun3@xiaomi.com>
unbind will call the adb_char_on_connect interface to wake up the adbd task,
adbd will then access the adb device and fail to return, at this time it will
close the adb device, we can do the final memory release operation in the
second unbind
Signed-off-by: dinglongfei <dinglongfei@xiaomi.com>
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)
------------------
How to test
From within nuttx/. Configure:
cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja
(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja
This uses ninja generator (install with sudo apt install ninja-build). To build:
$ cmake --build build
menuconfig:
$ cmake --build build -t menuconfig
--------------------------
2. cmake/build: reformat the cmake style by cmake-format
https://github.com/cheshirekow/cmake_format
$ pip install cmakelang
$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done
Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>