187 lines
4.5 KiB
C
187 lines
4.5 KiB
C
/**************************************************************************/
|
|
/*!
|
|
@file usbconfig.c
|
|
@author K. Townsend (microBuilder.eu)
|
|
@date 22 March 2010
|
|
@version 0.10
|
|
|
|
@section LICENSE
|
|
|
|
Software License Agreement (BSD License)
|
|
|
|
Copyright (c) 2010, microBuilder SARL
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
1. Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
notice, this list of conditions and the following disclaimer in the
|
|
documentation and/or other materials provided with the distribution.
|
|
3. Neither the name of the copyright holders nor the
|
|
names of its contributors may be used to endorse or promote products
|
|
derived from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.
|
|
*/
|
|
/**************************************************************************/
|
|
|
|
#include "usb.h"
|
|
#include "usbconfig.h"
|
|
|
|
#ifndef WBVAL
|
|
#define WBVAL(x) ((x) & 0xFF),(((x) >> 8) & 0xFF)
|
|
#endif
|
|
|
|
/* USB String Descriptor (optional) */
|
|
const uint8_t USB_HIDStringDescriptor[] =
|
|
{
|
|
/* Index 0x00: LANGID Codes */
|
|
0x04, /* bLength */
|
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
WBVAL(0x0409), /* US English */ /* wLANGID */
|
|
/* Index 0x04: Manufacturer */
|
|
0x1C, /* bLength */
|
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
'C',0,
|
|
'C',0,
|
|
'C',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
/* Index 0x20: Product */
|
|
0x28, /* bLength */
|
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
'r',0,
|
|
'0',0,
|
|
'k',0,
|
|
'e',0,
|
|
't',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
/* Index 0x48: Serial Number */
|
|
0x1A, /* bLength */
|
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
/* Index 0x62: Interface 0, Alternate Setting 0 */
|
|
0x0E, /* bLength */
|
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
'H',0,
|
|
'I',0,
|
|
'D',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
};
|
|
|
|
/* USB String Descriptor (optional) */
|
|
const uint8_t USB_MSCStringDescriptor[] =
|
|
{
|
|
/* Index 0x00: LANGID Codes */
|
|
0x04, /* bLength */
|
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
WBVAL(0x0409), /* US English */ /* wLANGID */
|
|
/* Index 0x04: Manufacturer */
|
|
0x1C, /* bLength */
|
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
'C',0,
|
|
'C',0,
|
|
'C',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
/* Index 0x20: Product */
|
|
0x28, /* bLength */
|
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
'r',0,
|
|
'0',0,
|
|
'k',0,
|
|
'e',0,
|
|
't',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
' ',0,
|
|
/* Index 0x48: Serial Number */
|
|
0x1A, /* bLength */
|
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
'0',0,
|
|
/* Index 0x62: Interface 0, Alternate Setting 0 */
|
|
0x0E, /* bLength */
|
|
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
|
|
'M',0,
|
|
'e',0,
|
|
'm',0,
|
|
'o',0,
|
|
'r',0,
|
|
'y',0,
|
|
};
|