mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
usbus/msc: add CONFIG_USBUS_MSC_AUTO_MTD option to create LUNs on init
This commit is contained in:
parent
f3dc90c63a
commit
bbda85221e
@ -73,6 +73,16 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USBUS MSC auto MTD setting
|
||||
*
|
||||
* When set to 1, the USBUS MSC module will automatically create a LUN for
|
||||
* each MTD device defined in `board.h`.
|
||||
*/
|
||||
#ifndef CONFIG_USBUS_MSC_AUTO_MTD
|
||||
#define CONFIG_USBUS_MSC_AUTO_MTD 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USBUS endpoint 0 buffer size
|
||||
*
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <stdint.h>
|
||||
#include "usb/usbus.h"
|
||||
#include "usb/usbus/msc/scsi.h"
|
||||
#include "mtd.h"
|
||||
#include "mtd_default.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -16,6 +16,13 @@ menuconfig MODULE_USBUS_MSC
|
||||
|
||||
if MODULE_USBUS_MSC
|
||||
|
||||
config USBUS_MSC_AUTO_MTD
|
||||
bool "Automatically export all MTD devices via USB"
|
||||
default true
|
||||
help
|
||||
This will automatically export all MTD devices that follow
|
||||
the default naming scheme on startup.
|
||||
|
||||
config USBUS_MSC_VENDOR_ID
|
||||
string "MSC Vendor ID"
|
||||
default "RIOT-OS"
|
||||
|
@ -354,6 +354,13 @@ static void _init(usbus_t *usbus, usbus_handler_t *handler)
|
||||
|
||||
/* Prepare to receive first bytes from Host */
|
||||
usbdev_ep_xmit(msc->ep_out->ep, msc->out_buf, CONFIG_USBUS_EP0_SIZE);
|
||||
|
||||
/* Auto-configure all MTD devices */
|
||||
if (CONFIG_USBUS_MSC_AUTO_MTD) {
|
||||
for (int i = 0; i < USBUS_MSC_EXPORTED_NUMOF; i++) {
|
||||
usbus_msc_add_lun(usbus, mtd_default_get_dev(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int _control_handler(usbus_t *usbus, usbus_handler_t *handler,
|
||||
|
Loading…
Reference in New Issue
Block a user