ен совсем в курсе обсуждений - но что бы оно туда упало - достаточно прописать правильный класс устройства в дескрипторе и все...
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено проходивший 20 сентября 2004 г. 14:45
В ответ на: FLIP + USB отправлено Wwwitalik 20 сентября 2004 г. 12:38

ну конечно надо правильно обрабатывать запросы от хоста - но это 9 глава USB стандарта и все го то.

вот пример


/*
Дескрпторы USB устройства
Наше устройство удовлетворяет
специфицикациям HID - присутствует
Report дескриптор
---------------------------*/
WORD USBDeviceDescriptor [18] =
{
18, 1, // Length, Type
0x10, 1, // USB Rev 1.1 (=0110H, low=10H, High=01H)
0, 0, 0, // Class, Subclass and Protocol
16, // EP0 size= 16 bytes
0x88,0x55, // Vendor ID = 21896
1, 0, // Product ID = 01
1, 0, // and Version
1, 2, 3, // Manufacturer, Product , // -> temp no Serial# Names
1 }; // #Configs
// ------------------------------------
/* ConfigurationDescriptor */
WORD USBConfigDescriptor [34+7] = //[34] =
{
9, 2, // Length, Type
(34+7), // Low(ConfigLength)
(0), // Hi (ConfigLength)
1, 1, 0, // #Interfaces, Configuration#, Config. Name
0x80, // Attributes = Bus Powered
80, // Max. Power is 80x2 = 160mA
// InterfaceDescriptor:
9, 4, // Length, Type
0, 0, 2, //1, // No alternate setting, HID uses EP1 // want 2 EP
3, // Class = Human Interface Device
0, 0, // Subclass and Protocol
0, // Interface Name
// HIDDescriptor:
9, 0x21, // Length, Type
0, 1, // HID Class Specification compliance
0, // Country localization (=none)
1, // Number of descriptors to follow
0x22, // And it's a Report descriptor
(30), // Low (ReportLength)
(0), // High(ReportLength)
// EndpointDescriptor: Interrupt IN
7, 5, // Length, Type
0x82, // Address = IN 2
0x03, // Interrupt
64, 0, // Maximum packet size
1, // Poll every 1 msec ()
// EndpointDescriptor: Interrupt Out
7, 5, // Length, Type
0x02, // Address = Out 2
0x03, // Interrupt
64, 0, // Maximum packet size
1 // Poll every 1 msec ()
};
// ----------------------


WORD HIDReportDescriptor[30] = {
6, 0, 0xFF, //Usage_Page (Vendor Defined)
9, 1, //Usage (I/O Device)
0xA1, 1, // Collection (Application)
0x85, ReportID, // REPORT_ID (51)
0x19, 1, // Usage_Minimum
0x29, 1, // Usage_Maximum
0x15, 0, // Logical_Minimum (0)
0x25, 0xff, // Logical_Maximum (255)
0x75, 8, // Report_Size (8)
0x95, ReportCount, // Report_Count (8)
0x81, 2, // Input (Data,Var,Abs)
0x19, 1, // Usage_Minimum
0x29, 1, // Usage_Maximum
0x91, 2, // Output (Data,Var,Abs)
0xC0 // End_Collection
};

/*
WORD HIDReportDescriptor[24] = {
0x85, 0x33, // REPORT_ID (51)
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x29, 0x02, // USAGE_MAXIMUM (Vendor Usage 2)
0x19, 0x01, // USAGE_MINIMUM (Vendor Usage 1)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x08, // REPORT_SIZE (8)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0 // END_COLLECTION
};
*/


/*---------------------------*/
// Строки для
WORD USBString0[4] = // Declare the UNICODE strings
{4, 3, 9, 4}; // Only English language strings supported

// Manufacturer
WORD USBString1[24] =
{
(24),3, // Length, Type
'x',0,'x',0,'x',0,'x',0,'x',0,'x',0,' ',0,'l',0,'t',0,'d',0,'.',0
};
// Product Name
WORD USBString2[44] =
{
(44),3, // Length, Type
'x',0,'x',0,'x',0,'x',0,'x',0,'x',0,' ',0,
'x',0,'x',0,'x',0,'x',0,'x',0,'x',0,'x',0,'x',0,'x',0,' ',0,
'x',0,'0',0,'0',0,'x',0
};
// Serial Number
WORD USBString3[26] =
{
(26),3, // Length, Type
'0',0, '3',0, '2',0, '3',0, '4',0, '5',0,
'6',0, '7',0, '8',0, '9',0, '0',0, '1',0,
};

// --- количество строк и массив указателей на них --
#define USBStringCount 4
pWORD StringIndex[USBStringCount] = {&USBString0[0], &USBString1[0],
&USBString2[0], &USBString3[0]};



Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru