Que desesperación, sigue sin funcionar. ¿Podeis enviarme el descriptor hid que utilizais? Sólo ahí me queda el fallo.
yo utilizo este
Código:
-------------------------------------------------------------------
The look-up table scheme also applies to the configuration
descriptor. A USB device may have multiple configuration
descriptors, i.e. CFG01, CFG02, etc. To add a configuration
descriptor, user must implement a structure similar to CFG01.
The next step is to add the configuration descriptor name, i.e.
cfg01, cfg02,.., to the look-up table USB_CD_Ptr. USB_CD_Ptr[0]
is a dummy place holder since configuration 0 is the un-configured
state according to the definition in the USB specification.
********************************************************************/
/*********************************************************************
* Descriptor specific type definitions are defined in:
* usb_device.h
*
* Configuration options are defined in:
* usb_config.h
********************************************************************/
#ifndef __USB_DESCRIPTORS_C
#define __USB_DESCRIPTORS_C
/** INCLUDES *******************************************************/
#include "GenericTypeDefs.h"
#include "Compiler.h"
#include "usb_config.h"
#include "usb_device.h"
#include "usb_function_hid.h"
/** CONSTANTS ******************************************************/
#if defined(__18CXX)
#pragma romdata
#endif
/* Device Descriptor */
ROM USB_DEVICE_DESCRIPTOR device_dsc=
{
0x12, // Size of this descriptor in bytes
USB_DESCRIPTOR_DEVICE, // DEVICE descriptor type
0x0200, // USB Spec Release Number in BCD format
0x00, // Class Code
0x00, // Subclass code
0x00, // Protocol code
USB_EP0_BUFF_SIZE, // Max packet size for EP0, see usb_config.h
MY_VID, // Vendor ID
MY_PID, // Product ID: Mouse in a circle fw demo
0x0107,//0x0003, // Device release number in BCD format
0x01, // Manufacturer string index
0x02, // Product string index
0x00, // Device serial number string index
0x01 // Number of possible configurations
};
/* Configuration 1 Descriptor */
ROM BYTE configDescriptor1[]={
/* Configuration Descriptor */
0x09,//sizeof(USB_CFG_DSC), // Size of this descriptor in bytes
USB_DESCRIPTOR_CONFIGURATION, // CONFIGURATION descriptor type
DESC_CONFIG_WORD(0x0026), // Total length of data for this cfg
1, // Number of interfaces in this cfg
1, // Index value of this configuration
0, // Configuration string index
0x80,//_DEFAULT | _SELF, // Attributes, see usb_device.h
250, // Max power consumption (2X mA)
/* Interface Descriptor */
0x09,//sizeof(USB_INTF_DSC), // Size of this descriptor in bytes
USB_DESCRIPTOR_INTERFACE, // INTERFACE descriptor type
0, // Interface Number
0, // Alternate Setting Number
1, // Number of endpoints in this intf
HID_INTF, // Class code
BOOT_INTF_SUBCLASS, // Subclass code
HID_PROTOCOL_NONE, // Protocol code
0, // Interface string index
/* HID Class-Specific Descriptor */
0x09,//sizeof(USB_HID_DSC)+3, // Size of this descriptor in bytes RRoj hack
DSC_HID, // HID descriptor type
DESC_CONFIG_WORD(0x0110), // HID Spec Release Number in BCD format (1.11)
0x21, // Country Code (0x00 for Not supported)
HID_NUM_OF_DSC, // Number of class descriptors, see usbcfg.h
DSC_RPT, // Report descriptor type
DESC_CONFIG_WORD(67), //sizeof(hid_rpt01), // Size of the report descriptor
/* Endpoint Descriptor */
0x07,/*sizeof(USB_EP_DSC)*/
USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
HID_EP | _EP_IN, //EndpointAddress
_INTERRUPT, //Attributes
DESC_CONFIG_WORD(8), //size
0x0A //Interval
};
//Language code string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[1];}sd000={
sizeof(sd000),USB_DESCRIPTOR_STRING,{0x0409
}};
//Manufacturer string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[25];}sd001={
sizeof(sd001),USB_DESCRIPTOR_STRING,
{'M','i','c','r','o','c','h','i','p',' ',
'T','e','c','h','n','o','l','o','g','y',' ','I','n','c','.'
}};
//Product string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD string[22];}sd002={
sizeof(sd002),USB_DESCRIPTOR_STRING,
{'V','i','r','t','u','a','l',' ','D','j','s',' ','C','o','n','t','r','o','l','l','e','r'
}};
//Class specific descriptor - HID mouse
ROM struct{BYTE report[HID_RPT01_SIZE];}hid_rpt01={
// {0x05, 0x01, /* Usage Page (Generic Desktop) */
// 0x09, 0x02, /* Usage (Mouse) */
// 0xA1, 0x01, /* Collection (Application) */
// 0x09, 0x01, /* Usage (Pointer) */
// 0xA1, 0x00, /* Collection (Physical) */
// 0x05, 0x09, /* Usage Page (Buttons) */
// 0x19, 0x01, /* Usage Minimum (01) */
// 0x29, 0x03, /* Usage Maximum (03) */
// 0x15, 0x00, /* Logical Minimum (0) */
// 0x25, 0x01, /* Logical Maximum (0) */
// 0x95, 0x03, /* Report Count (3) */
// 0x75, 0x01, /* Report Size (1) */
// 0x81, 0x02, /* Input (Data, Variable, Absolute) */
// 0x95, 0x01, /* Report Count (1) */
// 0x75, 0x05, /* Report Size (5) */
// 0x81, 0x01, /* Input (Constant) ;5 bit padding */
// 0x05, 0x01, /* Usage Page (Generic Desktop) */
// 0x09, 0x30, /* Usage (X) */
// 0x09, 0x31, /* Usage (Y) */
// 0x15, 0x81, /* Logical Minimum (-127) */
// 0x25, 0x7F, /* Logical Maximum (127) */
// 0x75, 0x08, /* Report Size (8) */
// 0x95, 0x02, /* Report Count (2) */
// 0x81, 0x06, /* Input (Data, Variable, Relative) */
// 0xC0, 0xC0}
{
0x05, 0x01, //Usage Page (Generic Desktop)
0x09, 0x04, //Usage (Joystick)
0xA1, 0x01, //Collection (Application)
0xA1, 0x02, //Collection (Logical)
0x75, 0x08, //Report size (8)
0x95, 0x04, //Report count (4)
0x15, 0x00, //Logical Minimum (-127)
0x26, 0xFF, 0x00, //Logical Maximum (128)
0x35, 0x00, //Physical Minumum (0)
0x46, 0xFF, 0x00, //Physical Maximum (255)
0x09, 0x30, //Usage (X)
0x09, 0x31, //Usage (Y)
0x09, 0x32, //Usage (Z)
0x09, 0x35, //Usage (Rz)
0x81, 0x02, //Input (Data, Variable, Absolute)
0x75, 0x08, //Report size (8)
0x95, 0x01, //Report count (1)
0x25, 0x07, //Logical Maximum (7)
0x46, 0x3B, 0x01, //Physical Maximum (315)
0x65, 0x14, //Unit (Eng Rot: Degree)
0x09, 0x39, //Usage (Hat switch)
0x81, 0x42, //
0x65, 0x00, //Unit (None)
0x75, 0x01, //Report size (1)
0x95, 0x08, //Report count (8)
0x25, 0x01, //Logical Maximum (1)
0x45, 0x01, //Physical Maximum (1)
0x05, 0x09, //Usage Page (Button)
0x19, 0x01, //Usage Minumum (Button 1)
0x29, 0x08, //Usage Maximum (Button 8)
0x81, 0x02, //Input (Data, Variable, Relative)
0xC0, //End collection
0xC0 //End collection
//// size 53
// 0x05, 0x01,
// 0x09, 0x04,
// 0xa1, 0x01,
// 0x09, 0x01,
// 0xa1, 0x00,
// 0x75, 0x08,
// 0x95, 0x04,
// 0x15, 0x00,
// 0x25, 0xff,
// 0x35, 0x00,
// 0x46, 0xff, 0x00,
// 0x05, 0x01,
// 0x09, 0x30,
// 0x09, 0x31,
// 0x09, 0x32,
// 0x09, 0x35,
// 0x81, 0x02,
// 0x75, 0x01,
// 0x95, 0x08,
// 0x25, 0x01,
// 0x45, 0x01,
// 0x05, 0x09,
// 0x19, 0x01,
// 0x29, 0x08,
// 0x81, 0x02,
// 0xc0,
// 0xc0
}
};/* End Collection,End Collection */
//Array of configuration descriptors
ROM BYTE *ROM USB_CD_Ptr[]=
{
(ROM BYTE *ROM)&configDescriptor1
};
//Array of string descriptors
ROM BYTE *ROM USB_SD_Ptr[]=
{
(ROM BYTE *ROM)&sd000,
(ROM BYTE *ROM)&sd001,
(ROM BYTE *ROM)&sd002
};
/** EOF usb_descriptors.c ***************************************************/
#endif
a lo mejor te sirve yo aun no puedo recibir nada pero si puedo enviar
Última edición: