Forum: Mikrocontroller und Digitale Elektronik Ein Endpoint als HID und einer als Virt-COM?


von Florian D. (fdsurfer)


Lesenswert?

Hallo,

ist es möglich einen Endpoint als HID und einen als virtuelle COM 
einzustellen?

Ich verwende einen MAX3420e (SPI-USB-bridge). Dabei bisher einen 
Endpoint (EP1) als USB->Device und EP3 als Device->USB. Nun möchte ich 
einen weiteren Endpoint (EP2) nutzen. Diesen am liebsten als virtuelle 
COM, zunächst würde aber auch HID-Kanal reichen.

Wenn ich meinen Gerätemanager aufmache ist dort bei HID zwei Einträge 
vorhanden. Sind das meine bisherigen Endpoint? Erscheint da dann noch 
ein dritter?

Kann mir da wer weiterhelfen?


Hier mal mein Descriptor:

PROBLEM DABEI:
Es wird dann immer nur der zu erstgennte Endpoint abgefragt. Liegt das 
an der hid.dll?

Code: {
const uint16_t DD[]=  // DEVICE Descriptor
    {
        0x12,             // bLength = 18d
        0x01,      // bDescriptorType = Device (1)
        0x10,0x01,    // bcdUSB(L/H) USB spec rev (BCD)
        0x00,0x00,0x00,   // bDeviceClass, bDeviceSubClass, 
bDeviceProtocol
        0x40,      // bMaxPacketSize0 EP0 is 64 bytes
        0x2a,0x15,    // idVendor(L/H)--Maxim is 0B6A
        0x60,0x83,    // idProduct(L/H)--5346
        0x34,0x12,    // bcdDevice--1234
        1,2,3,      // iManufacturer, iProduct, iSerialNumber
        1      // bNumConfigurations
    };

const uint16_t CD[]=  // CONFIGURATION Descriptor
    {
        0x09,      // bLength
        0x02,      // bDescriptorType = Config
        0x30,0x00,    // wTotalLength(L/H) = 48 bytes
        0x01,      // bNumInterfaces
        0x01,      // bConfigValue
        0x00,      // iConfiguration
        0x80,      // bmAttributes. b7=1 b6=self-powered b5=RWU 
supported
        0x32,      // MaxPower is 2 ma
        // INTERFACE Descriptor
        0x09,      // length = 9
        0x04,      // type = IF
        0x00,      // IF #0
        0x00,      // bAlternate Setting
        0x03,      // bNum Endpoints
        0x03,      // bInterfaceClass = HID
        0x00,0x00,    // bInterfaceSubClass, bInterfaceProtocol
        0x00,      // iInterface
        // HID Descriptor--It's at CD[18]
        0x09,      // bLength
        0x21,      // bDescriptorType = HID
        0x10,0x01,    // bcdHID(L/H) Rev 1.1
        0x00,      // bCountryCode (none)
        0x01,      // bNumDescriptors (one report descriptor)
        0x22,      // bDescriptorType  (report)
        47,0,                   // CD[25]: wDescriptorLength(L/H) 
(report descriptor size is 43 bytes)
        // IN-Endpoint Descriptor
        0x07,      // bLength
        0x05,      // bDescriptorType (Endpoint)
        0x82,      // bEndpointAddress (EP2-IN)
        0x03,      // bmAttributes  (interrupt)
        0x3f,0,           // wMaxPacketSize (63)
        8,          // bInterval (poll every 8 msec)
         // IN-Endpoint Descriptor
        0x07,      // bLength
        0x05,      // bDescriptorType (Endpoint)
        0x83,      // bEndpointAddress (EP3-IN)
        0x03,      // bmAttributes  (interrupt)
        0x3f,0,           // wMaxPacketSize (63)
        4,            // bInterval (poll every 8 msec)
       // OUT-Endpoint Descriptor
        0x07,      // bLength
        0x05,      // bDescriptorType (Endpoint)
        0x01,      // bEndpointAddress (EP1-OUT)
        0x03,      // bmAttributes  (interrupt)
        0x16,0,           // wMaxPacketSize (22)
        16      // bInterval (poll every 8 msec)

    };

const uint16_t RepD[] =
    {
        0x06, 0xA0, 0xff,              // USAGE_PAGE (Vendor Defined 
Page 1)
        0x09, 0x01,                    // USAGE (Instance 1)
        0xa1, 0x01,                    // COLLECTION (Application)

        0x09, 0x03,                    //   USAGE (Instance 3) MAX to PC
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255)
        0x95, BYTES_TO_PC,              //   REPORT_COUNT (2)
        0x75, 0x08,                    //   REPORT_SIZE (8)
        0x81, 0x02,                    //   INPUT (Data,Var,Abs)

        0x09, 0x04,                    //   USAGE (Instance 3) MAX to PC
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255)
        0x95, BYTES_TO_PC,              //   REPORT_COUNT (2)
        0x75, 0x08,                    //   REPORT_SIZE (8)
        0x81, 0x02,                    //   INPUT (Data,Var,Abs)

        0x09, 0x05,                    //   USAGE (Instance 4) PC to 
Device
        0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
        0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255)
        0x75, 0x08,                    //   REPORT_SIZE (8)
        0x95, BYTES_TO_DEVICE,          //   REPORT_COUNT (2)
        0x91, 0x02,                    //   OUTPUT (Data,Var,Abs)

        0xc0                           //     END_COLLECTION
    };
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.