make it possible to disable VFS and MSC via makefile
This commit is contained in:
@@ -164,7 +164,9 @@ static uint8_t USBD_MSC_CDC_Init(struct _USBD_HandleTypeDef *pdev, uint8_t cfgid
|
||||
{
|
||||
// this is not correct, but will work if neither returns BUSY (which they don't)
|
||||
uint8_t ret = 0;
|
||||
#ifndef DISABLE_MSC
|
||||
ret |= USBD_MSC_Init(pdev, cfgidx);
|
||||
#endif
|
||||
ret |= USBD_CDC_Init(pdev, cfgidx);
|
||||
return ret;
|
||||
}
|
||||
@@ -172,7 +174,9 @@ static uint8_t USBD_MSC_CDC_Init(struct _USBD_HandleTypeDef *pdev, uint8_t cfgid
|
||||
static uint8_t USBD_MSC_CDC_DeInit(struct _USBD_HandleTypeDef *pdev, uint8_t cfgidx)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
#ifndef DISABLE_MSC
|
||||
ret |= USBD_MSC_DeInit(pdev, cfgidx);
|
||||
#endif
|
||||
ret |= USBD_CDC_DeInit(pdev, cfgidx);
|
||||
return ret;
|
||||
}
|
||||
@@ -199,7 +203,9 @@ static uint8_t USBD_MSC_CDC_Setup(struct _USBD_HandleTypeDef *pdev, USBD_SetupRe
|
||||
}
|
||||
|
||||
// class specific, or Interface -> Clear Feature
|
||||
#ifndef DISABLE_MSC
|
||||
USBD_MSC_Setup(pdev, req);
|
||||
#endif
|
||||
USBD_CDC_Setup(pdev, req);
|
||||
return USBD_OK;
|
||||
}
|
||||
@@ -291,6 +297,9 @@ uint8_t *USBD_MSC_CDC_GetFSCfgDesc (uint16_t *length)
|
||||
|
||||
// Optionally hide settings (if lock jumper is installed)
|
||||
bool msc_visible = SystemSettings.editable;
|
||||
#ifdef DISABLE_MSC
|
||||
msc_visible = false;
|
||||
#endif
|
||||
USBD_MSC_CDC_CfgFSDesc[14] = (uint8_t) (msc_visible ? 0x08 : 0xFF);
|
||||
|
||||
return USBD_MSC_CDC_CfgFSDesc;
|
||||
@@ -316,7 +325,7 @@ uint8_t *USBD_MSC_CDC_GetUsrStrDescriptor(struct _USBD_HandleTypeDef *pdev, uin
|
||||
{
|
||||
const char *str;
|
||||
switch (index) {
|
||||
case 0x04: str = "Settings Virtual Mass Storage"; break;
|
||||
case 0x04: str = "Settings VFS"; break;
|
||||
case 0x05: str = "Virtual Comport ACM"; break;
|
||||
case 0x06: str = "Virtual Comport CDC"; break;
|
||||
default: str = "No Descriptor";
|
||||
|
||||
@@ -75,7 +75,9 @@ void MX_USB_DEVICE_Init(void)
|
||||
|
||||
USBD_RegisterClass(&hUsbDeviceFS, &USBD_MSC_CDC);
|
||||
|
||||
#ifndef DISABLE_MSC
|
||||
USBD_MSC_RegisterStorage(&hUsbDeviceFS, &USBD_Storage_Interface_fops_FS);
|
||||
#endif
|
||||
USBD_CDC_RegisterInterface(&hUsbDeviceFS, &USBD_Interface_fops_FS);
|
||||
|
||||
USBD_Start(&hUsbDeviceFS);
|
||||
|
||||
+3
-3
@@ -72,7 +72,7 @@
|
||||
/** @defgroup USBD_DESC_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
#define USBD_VID 1155
|
||||
#define USBD_VID 1155 // TODO choose a VID:PID (eg. via pid.codes - 0x1209)
|
||||
#define USBD_PID_FS 22314
|
||||
#define USBD_LANGID_NUM 1033
|
||||
#define USBD_MANUFACTURER_STRING "MightyPork"
|
||||
@@ -220,7 +220,7 @@ uint8_t * USBD_FS_LangIDStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *leng
|
||||
*/
|
||||
uint8_t * USBD_FS_ProductStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
|
||||
{
|
||||
USBD_GetString (USBD_PRODUCT_STRING_FS, USBD_StrDesc, length);
|
||||
USBD_GetString ((uint8_t *) USBD_PRODUCT_STRING_FS, USBD_StrDesc, length);
|
||||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ uint8_t * USBD_FS_ProductStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *len
|
||||
*/
|
||||
uint8_t * USBD_FS_ManufacturerStrDescriptor( USBD_SpeedTypeDef speed , uint16_t *length)
|
||||
{
|
||||
USBD_GetString (USBD_MANUFACTURER_STRING, USBD_StrDesc, length);
|
||||
USBD_GetString ((uint8_t *) USBD_MANUFACTURER_STRING, USBD_StrDesc, length);
|
||||
return USBD_StrDesc;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include <platform/status_led.h>
|
||||
#include "platform.h"
|
||||
#include "platform/status_led.h"
|
||||
#include "usbd_storage_if.h"
|
||||
/* USER CODE BEGIN INCLUDE */
|
||||
#include "vfs/vfs_manager.h"
|
||||
@@ -101,7 +101,7 @@
|
||||
*/
|
||||
/* USER CODE BEGIN INQUIRY_DATA_FS */
|
||||
/* USB Mass storage Standard Inquiry Data */
|
||||
int8_t STORAGE_Inquirydata_FS[] = {/* 36 */
|
||||
uint8_t STORAGE_Inquirydata_FS[] = {/* 36 */
|
||||
/* LUN 0 */
|
||||
0x00,
|
||||
0x80,
|
||||
|
||||
Reference in New Issue
Block a user