메뉴 바로가기

서브메뉴 바로가기

본문 바로가기

logo

소프트웨어(윈도우) 일반

USB Device Descriptor

2007.07.09 19:42

WhiteAT 조회 수:6777

USB 장치가 호스트(예: PC)에 연결되면,
호스트는 연결된 USB 장치의 정보를 알아야 한다.
그 정보는 USB 장치에  일정한 형식으로 존재해야 하며, 요청시 정보를 제공한다.

만약 호스트에서 유효한 정보를 수신하지 못하며,
"알수 없는 장치"로 인식될 것이다.

이 장치에 대한 정보를 "Descriptor"라 한다.



Descriptor 는 여러 종류가 있다.

1. Device Descriptor
장치(대부분 하드웨어)에 대한 내용이 들어 있다.
자세한 것은 USB2.0 Spec 을 참조하고........................

간단한 예제를 살펴보면, 아래와 같다.

const char devDescriptor[] = {

             / Device descriptor */

             0x12,   // bLength , 전체 18bytes의 정보를 가지고 있다.

             0x01,   // bDescriptorType    , device descriptor 이다.

             0x10,   // bcdUSBL

             0x01,   //

             0x02,   // bDeviceClass:    CDC class code    , 장치의 종류

             0x00,   // bDeviceSubclass: CDC class sub code , (하위의)장치의 종류

             0x00,   // bDeviceProtocol: CDC Device protocol , 프로토콜 종류

             0x08,   // bMaxPacketSize0 최대 패킷 사이즈(8,16,32)

             0x54,   // idVendorL           , Vendor ID

             0x57,   //

             0x10,   // idProductL          , Product  ID

             0x00,   //

             0x10,   // bcdDeviceL      , Device Release Number

             0x01,   //

             0x00,   // iManufacturer    // 0x01 , Index of Manufacturer String Descriptor

             0x00,   // iProduct    ,      Index of Product String Descriptor

             0x00,   // SerialNumber    , Index of Serial Number String Descriptor

             0x01    // bNumConfigs    ,  Number of Possible Configurations

};