More improvements to the incomplete BluetoothHost demo - add Disconnection Event processing.
Remove unused macro in the host mode demos for the maximum Configuration Descriptor size.
This commit is contained in:
parent
a2e6d54336
commit
fd96b28882
24 changed files with 229 additions and 187 deletions
|
@ -28,15 +28,28 @@
|
|||
this software.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
*
|
||||
* USB Device Descriptor processing routines, to determine the overall device parameters. Descriptors are special
|
||||
* computer-readable structures which the host requests upon device enumeration, to determine information about
|
||||
* the attached device.
|
||||
*/
|
||||
|
||||
#include "DeviceDescriptor.h"
|
||||
|
||||
/** Reads and processes an attached device's Device Descriptor, to determine compatibility
|
||||
*
|
||||
* This routine checks to ensure that the attached device's class codes match those for Bluetooth devices.
|
||||
*
|
||||
* \return An error code from the \ref BluetoothHost_GetDeviceDescriptorDataCodes_t enum.
|
||||
*/
|
||||
uint8_t ProcessDeviceDescriptor(void)
|
||||
{
|
||||
USB_Descriptor_Device_t DeviceDescriptor;
|
||||
|
||||
/* Send the request to retrieve the device descriptor */
|
||||
if (USB_Host_GetDeviceDescriptor(&DeviceDescriptor) != HOST_SENDCONTROL_Successful)
|
||||
return ControlErrorDuringDeviceRead;
|
||||
return DevControlError;
|
||||
|
||||
/* Validate returned data - ensure the returned data is a device descriptor */
|
||||
if (DeviceDescriptor.Header.Type != DTYPE_Device)
|
||||
|
@ -47,7 +60,7 @@ uint8_t ProcessDeviceDescriptor(void)
|
|||
(DeviceDescriptor.SubClass != BLUETOOTH_DEVICE_SUBCLASS) ||
|
||||
(DeviceDescriptor.Protocol != BLUETOOTH_DEVICE_PROTOCOL))
|
||||
{
|
||||
return IncorrectDevice;
|
||||
return IncorrectBTDevice;
|
||||
}
|
||||
|
||||
return SuccessfulDeviceRead;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue