forked from stm/stm32-mw-usb-device
Release v2.11.5
This commit is contained in:
@@ -1,31 +1,46 @@
|
||||
## Contributing guide
|
||||
This document serves as a checklist before contributing to this repository.
|
||||
It includes links to read up on if topics are unclear to you.
|
||||
# Contributing guide
|
||||
|
||||
This guide mainly focuses on the proper use of Git.
|
||||
This guide mainly focuses on the steps to follow to submit an issue or a pull request.
|
||||
|
||||
### 1. Before opening an issue
|
||||
Please check the following boxes before posting an issue:
|
||||
- [ ] `Make sure you are using the latest commit (major releases are Tagged, but corrections are available as new commits).`
|
||||
- [ ] `Make sure your issue is a question/feedback/suggestions RELATED TO the software provided in this repository.` Otherwise, it should be discussed on the [ST Community/STM32 MCUs forum](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus).
|
||||
- [ ] `Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue.` Please refer to this [dashboard](https://github.com/orgs/STMicroelectronics/projects/5) for the list of issues and pull-requests. Do not forget to browse into the **closed** issues.
|
||||
## 1. Issues
|
||||
|
||||
### 2. Posting the issue
|
||||
When you have checked the previous boxes. You will find two templates (Bug Report or Other Issue) available in the **Issues** tab of the repository ([link](https://github.com/STMicroelectronics/stm32_mw_usb_device/issues/new/choose)).
|
||||
### 1.1 Before opening an issue
|
||||
|
||||
Before posting an issue, please ensure:
|
||||
* You are using the latest commit.
|
||||
* Your issue is **not** a vulnerability. Otherwise, please refer to section [3](CONTRIBUTING.md#3-vulnerabilities) below.
|
||||
* Your issue is **related to** the software provided in this repository. Otherwise, please refer to section [4](CONTRIBUTING.md#4-support-requests-and-miscellaneous) below.
|
||||
* Your issue is not already reported, fixed or discussed in a previous one. Remember to browse the **closed** issues.
|
||||
|
||||
### 1.2 Posting the issue
|
||||
|
||||
When you have checked the previous points, create a new report from the **Issues** tab of this repository. A couple of templates are available [here](../../issues/new/choose).
|
||||
|
||||
## 2. Pull Requests
|
||||
|
||||
### 2.1 Before opening a pull request
|
||||
|
||||
### 3. Pull Requests
|
||||
STMicrolectronics is happy to receive contributions from the community, based on an initial Contributor License Agreement (CLA) procedure.
|
||||
|
||||
* If you are an individual writing original source code and you are sure **you own the intellectual property**, then you need to sign an Individual CLA (https://cla.st.com).
|
||||
* If you work for a company that wants also to allow you to contribute with your work, your company needs to provide a Corporate CLA (https://cla.st.com) mentioning your GitHub account name.
|
||||
* If you are not sure that a CLA (Individual or Corporate) has been signed for your GitHub account you can check here (https://cla.st.com).
|
||||
* If you are an individual writing original source code and you are sure **you own the intellectual property**, then you need to sign an **Individual** [CLA](https://cla.st.com).
|
||||
* If you work for a company that wants also to allow you to contribute with your work, your company needs to provide a **Corporate** [CLA](https://cla.st.com) mentioning your GitHub account name.
|
||||
* If you are not sure that a CLA (Individual or Corporate) has been signed for your GitHub account you can check the [CLA](https://cla.st.com) dedicated page.
|
||||
|
||||
Please note that:
|
||||
* The Corporate CLA will always take precedence over the Individual CLA.
|
||||
* One CLA submission is sufficient, for any project proposed by STMicroelectronics.
|
||||
> [!IMPORTANT]
|
||||
> Please note that:
|
||||
> * The Corporate CLA will always take precedence over the Individual CLA.
|
||||
> * One CLA submission is sufficient, for any project proposed by STMicroelectronics.
|
||||
|
||||
#### How to proceed
|
||||
### 2.2 How to proceed
|
||||
|
||||
* We recommend to engage first a communication thru an issue, in order to present your proposal. Just to confirm that it corresponds to STMicroelectronics domain or scope.
|
||||
* We recommend to engage first a communication thru an issue, in order to present your proposal, just to confirm that it corresponds to STMicroelectronics' domain or scope.
|
||||
* Then fork the project to your GitHub account to further develop your contribution. Please use the latest commit version.
|
||||
* Please, submit one Pull Request for one new feature or proposal. This will ease the analysis and the final merge if accepted.
|
||||
* Please, submit one pull request per new feature or proposal. This will ease the analysis and the final merge if accepted.
|
||||
|
||||
## 3. Vulnerabilities
|
||||
|
||||
To report a **vulnerability**, please refer to the [SECURITY.md](./SECURITY.md) file for instructions.
|
||||
|
||||
## 4. Support requests and miscellaneous
|
||||
|
||||
For support requests or any other topics not related to the content of this repository, you can submit a post to the **ST Community** on the appropriate topic [page](https://community.st.com/s/topiccatalog).
|
||||
|
||||
@@ -71,6 +71,7 @@ extern "C" {
|
||||
#define USB_DEVICE_CLASS_AUDIO 0x01U
|
||||
#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01U
|
||||
#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02U
|
||||
#define AUDIO_SUBCLASS_MIDISTREAMING 0x03U
|
||||
#define AUDIO_PROTOCOL_UNDEFINED 0x00U
|
||||
#define AUDIO_STREAMING_GENERAL 0x01U
|
||||
#define AUDIO_STREAMING_FORMAT_TYPE 0x02U
|
||||
|
||||
@@ -162,6 +162,9 @@ USBD_ClassTypeDef USBD_AUDIO =
|
||||
USBD_AUDIO_GetCfgDesc,
|
||||
USBD_AUDIO_GetDeviceQualifierDesc,
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||
NULL,
|
||||
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||
};
|
||||
|
||||
#ifndef USE_USBD_COMPOSITE
|
||||
|
||||
@@ -129,6 +129,9 @@ USBD_ClassTypeDef USBD_CCID =
|
||||
USBD_CCID_GetOtherSpeedCfgDesc,
|
||||
USBD_CCID_GetDeviceQualifierDescriptor,
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||
NULL,
|
||||
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||
};
|
||||
|
||||
#ifndef USE_USBD_COMPOSITE
|
||||
|
||||
@@ -161,6 +161,9 @@ USBD_ClassTypeDef USBD_CDC =
|
||||
USBD_CDC_GetOtherSpeedCfgDesc,
|
||||
USBD_CDC_GetDeviceQualifierDescriptor,
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||
NULL,
|
||||
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||
};
|
||||
|
||||
#ifndef USE_USBD_COMPOSITE
|
||||
|
||||
@@ -130,7 +130,7 @@ USBD_ClassTypeDef USBD_CUSTOM_HID =
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||
NULL,
|
||||
#endif
|
||||
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||
};
|
||||
|
||||
#ifndef USE_USBD_COMPOSITE
|
||||
|
||||
@@ -940,6 +940,12 @@ static void DFU_Download(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req)
|
||||
if ((hdfu->dev_state == DFU_STATE_DNLOAD_IDLE) || (hdfu->dev_state == DFU_STATE_IDLE))
|
||||
{
|
||||
#if (USBD_DFU_VENDOR_CHECK_ENABLED == 1U)
|
||||
/* Fill the buffer to be checked with the address stored in data buffer */
|
||||
hdfu->buffer.d8[1] = (uint8_t)(hdfu->data_ptr & 0xFFU);
|
||||
hdfu->buffer.d8[2] = (uint8_t)((hdfu->data_ptr & 0xFF00U) >> 8U);
|
||||
hdfu->buffer.d8[3] = (uint8_t)((hdfu->data_ptr & 0xFF0000U) >> 16U);
|
||||
hdfu->buffer.d8[4] = (uint8_t)((hdfu->data_ptr & 0xFF000000U) >> 24U);
|
||||
|
||||
if (DfuInterface->VendorCheck(hdfu->buffer.d8, IS_DFU_SETADDRESSPOINTER, &VendorStatus) != USBD_OK)
|
||||
{
|
||||
/* Update the state machine */
|
||||
|
||||
@@ -128,6 +128,9 @@ USBD_ClassTypeDef USBD_HID =
|
||||
USBD_HID_GetOtherSpeedCfgDesc,
|
||||
USBD_HID_GetDeviceQualifierDesc,
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||
NULL,
|
||||
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||
};
|
||||
|
||||
#ifndef USE_USBD_COMPOSITE
|
||||
|
||||
@@ -127,7 +127,7 @@ USBD_ClassTypeDef USBD_MSC =
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||
NULL,
|
||||
#endif
|
||||
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||
};
|
||||
|
||||
/* USB Mass storage device Configuration Descriptor */
|
||||
|
||||
@@ -283,7 +283,7 @@ extern "C" {
|
||||
* Appendix C. Device Properties
|
||||
*/
|
||||
|
||||
/* MTP device properties code*/
|
||||
/* MTP device properties code */
|
||||
#define MTP_DEV_PROP_UNDEFINED 0x5000U
|
||||
#define MTP_DEV_PROP_BATTERY_LEVEL 0x5001U
|
||||
#define MTP_DEV_PROP_FUNCTIONAL_MODE 0x5002U
|
||||
@@ -336,7 +336,7 @@ extern "C" {
|
||||
#define MTP_CONT_TYPE_EVENT 4U
|
||||
|
||||
#ifndef MTP_STORAGE_ID
|
||||
#define MTP_STORAGE_ID 0x00010001U /* SD card is inserted*/
|
||||
#define MTP_STORAGE_ID 0x00010001U /* SD card is inserted */
|
||||
#endif /* MTP_STORAGE_ID */
|
||||
|
||||
#define MTP_NBR_STORAGE_ID 1U
|
||||
|
||||
@@ -53,15 +53,16 @@ extern "C" {
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DATA_TYPE = 0x00,
|
||||
REP_TYPE = 0x01,
|
||||
DATA_TYPE = 0x00U,
|
||||
REP_TYPE = 0x01U,
|
||||
} MTP_CONTAINER_TYPE;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
READ_FIRST_DATA = 0x00,
|
||||
READ_REST_OF_DATA = 0x01,
|
||||
READ_FIRST_DATA = 0x00U,
|
||||
READ_REST_OF_DATA = 0x01U,
|
||||
READ_SEND_ZLP_DATA = 0x02U
|
||||
} MTP_READ_DATA_STATUS;
|
||||
|
||||
|
||||
|
||||
@@ -128,6 +128,9 @@ USBD_ClassTypeDef USBD_MTP =
|
||||
USBD_MTP_GetOtherSpeedCfgDesc,
|
||||
USBD_MTP_GetDeviceQualifierDescriptor,
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||
NULL,
|
||||
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||
};
|
||||
|
||||
#ifndef USE_USBD_COMPOSITE
|
||||
|
||||
@@ -537,50 +537,30 @@ static void MTP_Get_PayloadContent(USBD_HandleTypeDef *pdev)
|
||||
{
|
||||
USBD_MTP_HandleTypeDef *hmtp = (USBD_MTP_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
|
||||
USBD_MTP_ItfTypeDef *hmtpif = (USBD_MTP_ItfTypeDef *)pdev->pUserData[pdev->classId];
|
||||
uint8_t *buffer = hmtp->GenericContainer.data;
|
||||
uint32_t i;
|
||||
uint8_t *buffer;
|
||||
uint32_t n_idx;
|
||||
|
||||
switch (hmtp->OperationsContainer.code)
|
||||
{
|
||||
case MTP_OP_GET_DEVICE_INFO:
|
||||
(void)MTP_Get_DeviceInfo();
|
||||
(void)USBD_memcpy(buffer, (const uint8_t *)&MTP_DeviceInfo, sizeof(MTP_DeviceInfo));
|
||||
|
||||
for (i = 0U; i < sizeof(MTP_StorageIDS); i++)
|
||||
{
|
||||
hmtp->GenericContainer.data[i] = buffer[i];
|
||||
}
|
||||
(void)USBD_memcpy(hmtp->GenericContainer.data, (const uint8_t *)&MTP_DeviceInfo,
|
||||
MIN(sizeof(MTP_DeviceInfo), MTP_MEDIA_PACKET));
|
||||
break;
|
||||
|
||||
case MTP_OP_GET_STORAGE_IDS:
|
||||
(void)MTP_Get_StorageIDS();
|
||||
(void)USBD_memcpy(buffer, (const uint8_t *)&MTP_StorageIDS, sizeof(MTP_StorageIDS));
|
||||
|
||||
for (i = 0U; i < sizeof(MTP_StorageIDS); i++)
|
||||
{
|
||||
hmtp->GenericContainer.data[i] = buffer[i];
|
||||
}
|
||||
(void)USBD_memcpy(hmtp->GenericContainer.data, (const uint8_t *)&MTP_StorageIDS, sizeof(MTP_StorageIDS));
|
||||
break;
|
||||
|
||||
case MTP_OP_GET_STORAGE_INFO:
|
||||
(void)MTP_Get_StorageInfo(pdev);
|
||||
(void)USBD_memcpy(buffer, (const uint8_t *)&MTP_StorageInfo, sizeof(MTP_StorageInfo));
|
||||
|
||||
for (i = 0U; i < sizeof(MTP_StorageInfo); i++)
|
||||
{
|
||||
hmtp->GenericContainer.data[i] = buffer[i];
|
||||
}
|
||||
(void)USBD_memcpy(hmtp->GenericContainer.data, (const uint8_t *)&MTP_StorageInfo, sizeof(MTP_StorageInfo));
|
||||
break;
|
||||
|
||||
case MTP_OP_GET_OBJECT_HANDLES:
|
||||
(void)MTP_Get_ObjectHandle(pdev);
|
||||
(void)USBD_memcpy(buffer, (const uint8_t *)&MTP_ObjectHandle, hmtp->ResponseLength);
|
||||
|
||||
for (i = 0U; i < hmtp->ResponseLength; i++)
|
||||
{
|
||||
hmtp->GenericContainer.data[i] = buffer[i];
|
||||
}
|
||||
(void)USBD_memcpy(hmtp->GenericContainer.data, (const uint8_t *)&MTP_ObjectHandle, hmtp->ResponseLength);
|
||||
break;
|
||||
|
||||
case MTP_OP_GET_OBJECT_INFO:
|
||||
@@ -589,12 +569,7 @@ static void MTP_Get_PayloadContent(USBD_HandleTypeDef *pdev)
|
||||
|
||||
case MTP_OP_GET_OBJECT_PROPS_SUPPORTED:
|
||||
(void)MTP_Get_ObjectPropSupp();
|
||||
(void)USBD_memcpy(buffer, (const uint8_t *)&MTP_ObjectPropSupp, sizeof(MTP_ObjectPropSupp));
|
||||
|
||||
for (i = 0U; i < sizeof(MTP_ObjectPropSupp); i++)
|
||||
{
|
||||
hmtp->GenericContainer.data[i] = buffer[i];
|
||||
}
|
||||
(void)USBD_memcpy(hmtp->GenericContainer.data, (const uint8_t *)&MTP_ObjectPropSupp, sizeof(MTP_ObjectPropSupp));
|
||||
break;
|
||||
|
||||
case MTP_OP_GET_OBJECT_PROP_DESC:
|
||||
@@ -604,12 +579,7 @@ static void MTP_Get_PayloadContent(USBD_HandleTypeDef *pdev)
|
||||
|
||||
case MTP_OP_GET_OBJECT_PROP_REFERENCES:
|
||||
MTP_Ref.ref_len = 0U;
|
||||
(void)USBD_memcpy(buffer, (const uint8_t *)&MTP_Ref.ref_len, sizeof(MTP_Ref.ref_len));
|
||||
|
||||
for (i = 0U; i < sizeof(MTP_Ref.ref_len); i++)
|
||||
{
|
||||
hmtp->GenericContainer.data[i] = buffer[i];
|
||||
}
|
||||
(void)USBD_memcpy(hmtp->GenericContainer.data, (const uint8_t *)&MTP_Ref.ref_len, sizeof(MTP_Ref.ref_len));
|
||||
break;
|
||||
|
||||
case MTP_OP_GET_OBJECT_PROPLIST:
|
||||
@@ -618,20 +588,13 @@ static void MTP_Get_PayloadContent(USBD_HandleTypeDef *pdev)
|
||||
|
||||
case MTP_OP_GET_OBJECT_PROP_VALUE:
|
||||
buffer = MTP_Get_ObjectPropValue(pdev);
|
||||
for (i = 0U; i < hmtp->ResponseLength; i++)
|
||||
{
|
||||
hmtp->GenericContainer.data[i] = buffer[i];
|
||||
}
|
||||
|
||||
(void)USBD_memcpy(hmtp->GenericContainer.data, (const uint8_t *)buffer, hmtp->ResponseLength);
|
||||
break;
|
||||
|
||||
case MTP_OP_GET_DEVICE_PROP_DESC:
|
||||
(void)MTP_Get_DevicePropDesc();
|
||||
(void)USBD_memcpy(buffer, (const uint8_t *)&MTP_DevicePropDesc, sizeof(MTP_DevicePropDesc));
|
||||
for (i = 0U; i < sizeof(MTP_DevicePropDesc); i++)
|
||||
{
|
||||
hmtp->GenericContainer.data[i] = buffer[i];
|
||||
}
|
||||
(void)USBD_memcpy(hmtp->GenericContainer.data, (const uint8_t *)&MTP_DevicePropDesc,
|
||||
MIN(sizeof(MTP_DevicePropDesc), MTP_MEDIA_PACKET));
|
||||
break;
|
||||
|
||||
case MTP_OP_SEND_OBJECT_INFO:
|
||||
@@ -837,7 +800,7 @@ static void MTP_Get_ObjectPropDesc(USBD_HandleTypeDef *pdev)
|
||||
|
||||
case MTP_OB_PROP_PARENT_OBJECT :
|
||||
MTP_ObjectPropDesc.ObjectPropertyCode = (uint16_t)(hmtp->OperationsContainer.Param1);
|
||||
MTP_ObjectPropDesc.DataType = MTP_DATATYPE_STR;
|
||||
MTP_ObjectPropDesc.DataType = MTP_DATATYPE_UINT32;
|
||||
MTP_ObjectPropDesc.GetSet = MTP_PROP_GET;
|
||||
MTP_ObjectPropDesc.DefValue = 0U;
|
||||
MTP_ObjectPropDesc.GroupCode = 0U;
|
||||
@@ -960,6 +923,7 @@ static void MTP_Get_ObjectPropList(USBD_HandleTypeDef *pdev)
|
||||
uint16_t format;
|
||||
uint64_t objsize;
|
||||
uint32_t parent_proval;
|
||||
uint8_t mtp_pers_uniq_obj_id[16] = {0};
|
||||
|
||||
MTP_PropertiesList.MTP_Properties_len = SUPP_OBJ_PROP_LEN;
|
||||
hmtp->ResponseLength = 4U; /* size of MTP_PropertiesList.MTP_Properties_len */
|
||||
@@ -1020,9 +984,13 @@ static void MTP_Get_ObjectPropList(USBD_HandleTypeDef *pdev)
|
||||
break;
|
||||
|
||||
case MTP_OB_PROP_PERS_UNIQ_OBJ_IDEN :
|
||||
/* Fill in the first 4 bytes with Param1 (Object ID) */
|
||||
(void)USBD_memcpy(mtp_pers_uniq_obj_id, &hmtp->OperationsContainer.Param1,
|
||||
sizeof(hmtp->OperationsContainer.Param1));
|
||||
|
||||
MTP_PropertiesList.MTP_Properties[i].PropertyCode = MTP_OB_PROP_PERS_UNIQ_OBJ_IDEN;
|
||||
MTP_PropertiesList.MTP_Properties[i].Datatype = MTP_DATATYPE_UINT128;
|
||||
MTP_PropertiesList.MTP_Properties[i].propval = (uint8_t *)&hmtp->OperationsContainer.Param1;
|
||||
MTP_PropertiesList.MTP_Properties[i].propval = (uint8_t *)mtp_pers_uniq_obj_id;
|
||||
break;
|
||||
|
||||
case MTP_OB_PROP_PROTECTION_STATUS :
|
||||
@@ -1187,7 +1155,8 @@ static uint32_t MTP_build_data_proplist(USBD_HandleTypeDef *pdev,
|
||||
MTP_PropertiesListTypedef proplist, uint32_t idx)
|
||||
{
|
||||
USBD_MTP_HandleTypeDef *hmtp = (USBD_MTP_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
|
||||
uint8_t propval_size = (MTP_FileName.FileName_len * 2U) + 1U;
|
||||
uint8_t *propval = proplist.MTP_Properties[idx].propval;
|
||||
uint8_t propval_size = (propval[0] * 2U) + 1U;
|
||||
uint32_t dataLength;
|
||||
|
||||
dataLength = offsetof(MTP_PropertiesTypedef, propval);
|
||||
|
||||
@@ -152,12 +152,20 @@ uint8_t USBD_MTP_STORAGE_ReadData(USBD_HandleTypeDef *pdev)
|
||||
/* Start USB data transmission to the host */
|
||||
(void)USBD_MTP_STORAGE_SendData(pdev, (uint8_t *)data_buff, MIN(MTP_DataLength.readbytes, buffer_size));
|
||||
|
||||
if (((MTP_DataLength.totallen + MTP_CONT_HEADER_SIZE) % hmtp->MaxPcktLen) == 0U)
|
||||
{
|
||||
/* Send ZLP Packet */
|
||||
ReadDataStatus = READ_SEND_ZLP_DATA;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Move to response phase */
|
||||
hmtp->MTP_ResponsePhase = MTP_RESPONSE_PHASE;
|
||||
|
||||
/* Reset the state machine */
|
||||
ReadDataStatus = READ_FIRST_DATA;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Start USB data transmission to the host */
|
||||
@@ -168,6 +176,19 @@ uint8_t USBD_MTP_STORAGE_ReadData(USBD_HandleTypeDef *pdev)
|
||||
}
|
||||
break;
|
||||
|
||||
case READ_SEND_ZLP_DATA:
|
||||
|
||||
/* Send ZLP to the host */
|
||||
(void)USBD_MTP_STORAGE_SendData(pdev, (uint8_t *)data_buff, 0U);
|
||||
|
||||
/* Move to response phase */
|
||||
hmtp->MTP_ResponsePhase = MTP_RESPONSE_PHASE;
|
||||
|
||||
/* Reset the state machine */
|
||||
ReadDataStatus = READ_FIRST_DATA;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -141,6 +141,9 @@ USBD_ClassTypeDef USBD_PRNT =
|
||||
USBD_PRNT_GetOtherSpeedCfgDesc,
|
||||
USBD_PRNT_GetDeviceQualifierDescriptor,
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||
NULL,
|
||||
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||
};
|
||||
|
||||
#ifndef USE_USBD_COMPOSITE
|
||||
|
||||
@@ -140,6 +140,9 @@ USBD_ClassTypeDef USBD_VIDEO =
|
||||
USBD_VIDEO_GetOtherSpeedCfgDesc,
|
||||
USBD_VIDEO_GetDeviceQualifierDesc,
|
||||
#endif /* USE_USBD_COMPOSITE */
|
||||
#if (USBD_SUPPORT_USER_STRING_DESC == 1U)
|
||||
NULL,
|
||||
#endif /* USBD_SUPPORT_USER_STRING_DESC */
|
||||
};
|
||||
|
||||
/* USB VIDEO device Configuration Descriptor (same for all speeds thanks to user defines) */
|
||||
|
||||
134
LICENSE.md
134
LICENSE.md
@@ -1,80 +1,94 @@
|
||||
SLA0044 Rev5/February 2018
|
||||
This software component is provided to you as part of a software package and
|
||||
applicable license terms are in the Package_license file. If you received this
|
||||
software component outside of a package or without applicable license terms,
|
||||
the terms of the SLA0044 license shall apply and are fully reproduced below:
|
||||
|
||||
SLA0044 Rev6/October 2025
|
||||
|
||||
## Software license agreement
|
||||
|
||||
### __ULTIMATE LIBERTY SOFTWARE LICENSE AGREEMENT__
|
||||
|
||||
BY INSTALLING, COPYING, DOWNLOADING, ACCESSING OR OTHERWISE USING THIS SOFTWARE
|
||||
OR ANY PART THEREOF (AND THE RELATED DOCUMENTATION) FROM STMICROELECTRONICS
|
||||
INTERNATIONAL N.V, SWISS BRANCH AND/OR ITS AFFILIATED COMPANIES
|
||||
(STMICROELECTRONICS), THE RECIPIENT, ON BEHALF OF HIMSELF OR HERSELF, OR ON
|
||||
BEHALF OF ANY ENTITY BY WHICH SUCH RECIPIENT IS EMPLOYED AND/OR ENGAGED AGREES
|
||||
TO BE BOUND BY THIS SOFTWARE LICENSE AGREEMENT.
|
||||
BY CLICKING ON THE "I ACCEPT" BUTTON OR BY UNZIPPING, INSTALLING, COPYING,
|
||||
DOWNLOADING, ACCESSING OR OTHERWISE USING THIS SOFTWARE OR ANY PART THEREOF,
|
||||
INCLUDING ANY RELATED DOCUMENTATION (collectively the “SOFTWARE”)
|
||||
FROM STMICROELECTRONICS INTERNATIONAL N.V, SWISS BRANCH AND/OR
|
||||
ITS AFFILIATED COMPANIES (collectively “STMICROELECTRONICS”),
|
||||
YOU (hereinafter referred also to as “THE RECIPIENT”), ON BEHALF OF YOURSELF,
|
||||
OR ON BEHALF OF ANY ENTITY BY WHICH YOU ARE EMPLOYED AND/OR ENGAGED,
|
||||
AGREE TO BE BOUND BY THIS AGREEMENT.
|
||||
|
||||
Under STMicroelectronics’ intellectual property rights, the redistribution,
|
||||
reproduction and use in source and binary forms of the software or any part
|
||||
Under STMICROELECTRONICS’ intellectual property rights, the redistribution,
|
||||
reproduction and use in source and binary forms of the SOFTWARE or any part
|
||||
thereof, with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
1. Redistribution of source code (modified or not) must retain any copyright
|
||||
notice, this list of conditions and the disclaimer set forth below as items 10
|
||||
and 11.
|
||||
notice accompanying the SOFTWARE, this list of conditions and the disclaimer below.
|
||||
|
||||
2. Redistributions in binary form, except as embedded into microcontroller or
|
||||
microprocessor device manufactured by or for STMicroelectronics or a software
|
||||
update for such device, must reproduce any copyright notice provided with the
|
||||
binary code, this list of conditions, and the disclaimer set forth below as
|
||||
items 10 and 11, in documentation and/or other materials provided with the
|
||||
distribution.
|
||||
2. Redistributions in binary form, except as embedded into a processing unit device
|
||||
manufactured by or for STMicroelectronics or a software update for any such device,
|
||||
must reproduce the accompanying copyright notice, this list of conditions,
|
||||
and the below disclaimer in capital type, in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of STMicroelectronics nor the names of other contributors to
|
||||
this software may be used to endorse or promote products derived from this
|
||||
software or part thereof without specific written permission.
|
||||
3. Neither the name of STMicroelectronics nor the names of other contributors
|
||||
to the SOFTWARE may be used to endorse or promote products derived
|
||||
from the SOFTWARE or part thereof without specific written permission.
|
||||
|
||||
4. This software or any part thereof, including modifications and/or derivative
|
||||
works of this software, must be used and execute solely and exclusively on or in
|
||||
combination with a microcontroller or microprocessor device manufactured by or
|
||||
for STMicroelectronics.
|
||||
4. The SOFTWARE or any part thereof, including modifications and/or
|
||||
derivative works of the SOFTWARE, must be used and execute solely
|
||||
and exclusively on or in combination with a processing unit device
|
||||
manufactured by or for STMicroelectronics.
|
||||
|
||||
5. No use, reproduction or redistribution of this software partially or totally
|
||||
may be done in any manner that would subject this software to any Open Source
|
||||
Terms. “Open Source Terms” shall mean any open source license which requires as
|
||||
part of distribution of software that the source code of such software is
|
||||
distributed therewith or otherwise made available, or open source license that
|
||||
substantially complies with the Open Source definition specified at
|
||||
www.opensource.org and any other comparable open source license such as for
|
||||
example GNU General Public License (GPL), Eclipse Public License (EPL), Apache
|
||||
Software License, BSD license or MIT license.
|
||||
5. No use, reproduction or redistribution of the SOFTWARE partially
|
||||
or totally may be done in any manner that would subject the SOFTWARE
|
||||
to any Open Source Terms. “Open Source Terms” shall mean
|
||||
any open source license which requires as part of distribution
|
||||
of software that the source code of such software is distributed
|
||||
therewith or otherwise made available, or open source license
|
||||
that substantially complies with the Open Source definition specified
|
||||
at www.opensource.org and any other comparable open source license
|
||||
such as for example GNU General Public License (GPL),
|
||||
Eclipse Public License (EPL), Apache Software License, BSD license
|
||||
or MIT license.
|
||||
|
||||
6. STMicroelectronics has no obligation to provide any maintenance, support or
|
||||
updates for the software.
|
||||
6. STMicroelectronics has no obligation to provide any maintenance,
|
||||
support or updates for the SOFTWARE.
|
||||
|
||||
7. The software is and will remain the exclusive property of STMicroelectronics
|
||||
and its licensors. The recipient will not take any action that jeopardizes
|
||||
STMicroelectronics and its licensors' proprietary rights or acquire any rights
|
||||
in the software, except the limited rights specified hereunder.
|
||||
7. The SOFTWARE is and will remain the exclusive property of
|
||||
STMicroelectronics and its licensors. The RECIPIENT will not take
|
||||
any action that jeopardizes STMicroelectronics and its
|
||||
licensors' proprietary rights or acquire any rights in the SOFTWARE,
|
||||
except the limited rights specified hereunder.
|
||||
|
||||
8. The recipient shall comply with all applicable laws and regulations affecting
|
||||
the use of the software or any part thereof including any applicable export
|
||||
control law or regulation.
|
||||
8. The RECIPIENT shall comply with all applicable laws and regulations
|
||||
affecting the use of the SOFTWARE or any part thereof including
|
||||
any applicable export control law or regulation.
|
||||
|
||||
9. Redistribution and use of this software or any part thereof other than as
|
||||
permitted under this license is void and will automatically terminate your
|
||||
rights under this license.
|
||||
9. Redistribution and use of the SOFTWARE or any part thereof other
|
||||
than as permitted under this AGREEMENT is void and will automatically
|
||||
terminate RECIPIENT’s rights under this AGREEMENT.
|
||||
|
||||
10. THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS, WHICH ARE
|
||||
DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT SHALL
|
||||
STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
10. The RECIPIENT shall be solely liable to determine and verify that
|
||||
the SOFTWARE is fit for the RECIPIENT intended use, environment or
|
||||
application and comply with all regulatory, safety and security
|
||||
related requirements concerning any use.
|
||||
|
||||
11. EXCEPT AS EXPRESSLY PERMITTED HEREUNDER, NO LICENSE OR OTHER RIGHTS, WHETHER
|
||||
EXPRESS OR IMPLIED, ARE GRANTED UNDER ANY PATENT OR OTHER INTELLECTUAL PROPERTY
|
||||
RIGHTS OF STMICROELECTRONICS OR ANY THIRD PARTY.
|
||||
DISCLAIMER:
|
||||
|
||||
THE SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING,BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
|
||||
AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS, ARE
|
||||
DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW.
|
||||
IN NO EVENT SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
EXCEPT AS EXPRESSLY PERMITTED HEREUNDER, NO LICENSE OR OTHER RIGHTS,
|
||||
WHETHER EXPRESS OR IMPLIED, ARE GRANTED UNDER ANY PATENT OR OTHER INTELLECTUAL
|
||||
PROPERTY RIGHTS OF STMICROELECTRONICS OR ANY THIRD PARTY.
|
||||
|
||||
48
README.md
48
README.md
@@ -1,36 +1,40 @@
|
||||
# Middleware USB Device MCU Component
|
||||
# USB Device Middleware Library MCU Software Component
|
||||
|
||||

|
||||

|
||||
|
||||
## Overview
|
||||
## Overview of the STM32Cube MCU offer on GitHub
|
||||
|
||||
**STM32Cube** is an STMicroelectronics original initiative to ease developers' life by reducing efforts, time and cost.
|
||||
|
||||
**STM32Cube** covers the overall STM32 products portfolio. It includes a comprehensive embedded software platform delivered for each STM32 series.
|
||||
* The CMSIS modules (core and device) corresponding to the ARM(tm) core implemented in this STM32 product.
|
||||
**STM32Cube** is an original initiative by STMicroelectronics to **simplify** prototyping and development by **reducing** effort, time, and cost. It supports the entire ARM™ Cortex-based STM32 microcontroller portfolio and provides a **comprehensive** software solution including:
|
||||
* The CMSIS Core and Device interfaces enabling access to processor core features and device-specific peripherals of STM32 microcontrollers.
|
||||
* The STM32 HAL-LL drivers, an abstraction layer offering a set of APIs ensuring maximized portability across the STM32 portfolio.
|
||||
* The BSP drivers of each evaluation, demonstration or nucleo board provided for this STM32 series.
|
||||
* A consistent set of middleware libraries such as RTOS, USB, FatFS, graphics, touch sensing library...
|
||||
* A full set of software projects (basic examples, applications, and demonstrations) for each board provided for this STM32 series.
|
||||
* The BSP drivers enabling access to peripherals on the STM32 development boards, external to the microcontroller itself.
|
||||
* A consistent set of middleware libraries offering standardized, high-level functionalities — such as USB, TCP/IP, file systems, and graphics.
|
||||
* A full set of software projects (basic examples, applications, and demonstrations) that showcase specific functionalities or use cases, and provided with support for multiple IDEs.
|
||||
|
||||
Two models of publication are proposed for the STM32Cube embedded software:
|
||||
* The monolithic **MCU Package**: all STM32Cube software modules of one STM32 series are present (Drivers, Middleware, Projects, Utilities) in the repository (usual name **STM32Cubexx**, xx corresponding to the STM32 series).
|
||||
* The **MCU component**: each STM32Cube software module being part of the STM32Cube MCU Package, is delivered as an individual repository, allowing the user to select and get only the required software functions.
|
||||
The **STM32Cube embedded software** is available in two flavors:
|
||||
* The **MCU Firmware** _monolithic_ offer, where **all** software components (Drivers, Middleware, Projects, Utilities) are included in a **single** repository for each STM32 series.
|
||||
* The **MCU Software Components** _modular_ offer, where **each** software component (mainly Drivers and Middleware) is provided in a **dedicated** repository, allowing users to **select** only the components they need.
|
||||
|
||||
## Description
|
||||
The complete list of repositories is available [here](https://github.com/STMicroelectronics/STM32Cube_MCU_Overall_Offer/blob/master/README.md#content).
|
||||
|
||||
This **stm32_mw_usb_device** MCU component repository is one element **common to all** STM32Cube MCU embedded software packages, providing the **USB Device MCU Middleware** part.
|
||||
## Repository content
|
||||
|
||||
It represents ST offer to ensure the support of USB Devices on STM32 MCUs.
|
||||
It includes two main modules:
|
||||
* **Core** module for the USB device standard peripheral control APIs. It includes the files ensuring USB 2.0 standard code implementation for an USB device.
|
||||
These files’ APIs will be called within every USB device application regardless of the desired functionality.
|
||||
* **Class** module for the commonly supported classes APIs. it includes the files including different USB device classes. All STM32 USB classes are implemented according to the USB 2.0 and every class’s specifications. These files’ APIs will be called within USB device applications according to the desired functionality.
|
||||
This repository provides the STM32Cube **USB Device** Middleware Library, **common to every** STM32Cube MCU firmware that supports it.
|
||||
|
||||
This represents STMicroelectronics’ offering to support the USB Device role on STM32 MCUs. It includes two main modules:
|
||||
|
||||
- **Core**: provides USB Device standard peripheral control APIs implementing the USB 2.0 standard code for a USB device. These APIs are called in every USB Device application, regardless of the desired functionality.
|
||||
|
||||
- **Class**: provides APIs for commonly supported USB Device classes complying with USB 2.0 standard and their respective class specifications. These APIs are called in USB Device applications based on the desired functionality.
|
||||
|
||||
## Release note
|
||||
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/stm32_mw_usb_device/blob/master/Release_Notes.html).
|
||||
Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/stm32-mw-usb-device/blob/master/Release_Notes.html).
|
||||
|
||||
## Troubleshooting
|
||||
## Compatibility information
|
||||
|
||||
Please refer to the **release note** in the firmware repository for the STM32 series you are using ([list](https://github.com/STMicroelectronics/STM32Cube_MCU_Overall_Offer/blob/master/README.md#stm32cube-mcu-packages)). It is **important** to use a **consistent set** of software component versions (i.e., CMSIS, HAL-LL, BSP, MW) as specified in the release note.
|
||||
|
||||
## Feedback and contributions
|
||||
|
||||
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) guide.
|
||||
@@ -59,7 +59,43 @@ Page</a> : STM32Cube USB Wiki Page</li>
|
||||
<section id="update-history" class="col-sm-12 col-lg-8">
|
||||
<h1>Update History</h1>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section25" checked aria-hidden="true">
|
||||
<input type="checkbox" id="collapse-section26" checked aria-hidden="true">
|
||||
<label for="collapse-section26" aria-hidden="true">V2.11.5 /
|
||||
26-September-2025</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr class="header">
|
||||
<th style="text-align: left;">Headline</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><strong>USB Core:</strong></td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">SLA0044 Legal terms updated to latest revision (Rev 6 / October 2025)</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;"><strong>USB Classes:</strong></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">Add missing NULL pointer for user string descriptor</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><strong>USB MTP Class:</strong></td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">Minor enhancement; improve device data buffer management</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section25" aria-hidden="true">
|
||||
<label for="collapse-section25" aria-hidden="true">V2.11.4 /
|
||||
11-April-2025</label>
|
||||
<div>
|
||||
@@ -379,7 +415,7 @@ Serial Bus Device Class Media Transfer Protocol Revision 1.1</td>
|
||||
Style</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">Update the way to declare licenses</td>
|
||||
<td style="text-align: left;">Update the way to declare Legal terms</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;"><strong>USB CDC/RNDIS/ECM
|
||||
@@ -757,8 +793,8 @@ NVIC_SystemReset() prototype change</td>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">Update license section by adding path to
|
||||
get copy of ST Ultimate Liberty license</td>
|
||||
<td style="text-align: left;">Update Legal terms section by adding path to
|
||||
get copy of ST Ultimate Liberty Legal terms</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">Core: Fix unexpected stall during status
|
||||
@@ -794,7 +830,7 @@ Break on USBD_Template_Setup API</td>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">Update license section</td>
|
||||
<td style="text-align: left;">Update Legal terms section</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">Update some functions to be MISRAC 2004
|
||||
@@ -1141,8 +1177,8 @@ development</strong></p>
|
||||
<td style="text-align: left;">Official support of STM32F4xx devices</td>
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td style="text-align: left;">All source files: license disclaimer text
|
||||
update and add link to the License file on ST Internet.</td>
|
||||
<td style="text-align: left;">All source files: Legal terms disclaimer text
|
||||
update and add link to the Legal terms file on ST Internet.</td>
|
||||
</tr>
|
||||
<tr class="odd">
|
||||
<td style="text-align: left;">Handle test mode in the set feature
|
||||
|
||||
31
SECURITY.md
Normal file
31
SECURITY.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Report potential product security vulnerabilities
|
||||
|
||||
ST places a high priority on security, and our Product Security Incident
|
||||
Response Team (PSIRT) is committed to rapidly addressing potential security
|
||||
vulnerabilities affecting our products. PSIRT's long history and vast experience
|
||||
in security allows ST to perform clear analyses and provide appropriate guidance
|
||||
on mitigations and solutions when applicable.
|
||||
|
||||
If you wish to report potential security vulnerabilities regarding our products,
|
||||
**please do not report them through public GitHub issues.** Instead, we
|
||||
encourage you to report them to our ST PSIRT following the process described at:
|
||||
**https://www.st.com/content/st_com/en/security/report-vulnerabilities.html**
|
||||
|
||||
### IMPORTANT - READ CAREFULLY:
|
||||
|
||||
STMicroelectronics International N.V., on behalf of itself, its affiliates and
|
||||
subsidiaries, (collectively “ST”) takes all potential security vulnerability
|
||||
reports or other related communications (“Report(s)”) seriously. In order to
|
||||
review Your Report (the terms “You” and “Yours” include your employer, and all
|
||||
affiliates, subsidiaries and related persons or entities) and take actions as
|
||||
deemed appropriate, ST requires that we have the rights and Your permission to
|
||||
do so.
|
||||
|
||||
As such, by submitting Your Report to ST, You agree that You have the right to
|
||||
do so, and You grant to ST the rights to use the Report for purposes related to
|
||||
security vulnerability analysis, testing, correction, patching, reporting and
|
||||
any other related purpose or function.
|
||||
|
||||
By submitting Your Report, You agree that ST’s
|
||||
[Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html)
|
||||
applies to all related communications.
|
||||
Reference in New Issue
Block a user