mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Reverted some USB changes.
This commit is contained in:
parent
480371a43e
commit
3cf4fe6512
@ -95,7 +95,7 @@ void PIOS_Board_Init(void) {
|
||||
}
|
||||
#if defined(PIOS_INCLUDE_USB_HID) && defined(PIOS_INCLUDE_COM_MSG)
|
||||
uint32_t pios_usb_hid_id;
|
||||
if (PIOS_USB_HID_Init(&pios_usb_hid_id, &pios_usb_hid_without_vcp_cfg, pios_usb_id)) {
|
||||
if (PIOS_USB_HID_Init(&pios_usb_hid_id, &pios_usb_hid_cfg, pios_usb_id)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
if (PIOS_COM_MSG_Init(&pios_com_telem_usb_id, &pios_usb_hid_com_driver, pios_usb_hid_id)) {
|
||||
|
@ -38,9 +38,9 @@ static const struct usb_device_desc device_desc = {
|
||||
.bLength = sizeof(struct usb_device_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_DEVICE,
|
||||
.bcdUSB = htousbs(0x0200),
|
||||
.bDeviceClass = 0xef,
|
||||
.bDeviceSubClass = 0x02,
|
||||
.bDeviceProtocol = 0x01,
|
||||
.bDeviceClass = 0x02,
|
||||
.bDeviceSubClass = 0x00,
|
||||
.bDeviceProtocol = 0x00,
|
||||
.bMaxPacketSize0 = 64, /* Must be 64 for high-speed devices */
|
||||
.idVendor = htousbs(USB_VENDOR_ID_OPENPILOT),
|
||||
.idProduct = htousbs(PIOS_USB_BOARD_PRODUCT_ID),
|
||||
@ -98,6 +98,10 @@ static const uint8_t hid_report_desc[36] = {
|
||||
struct usb_config_hid_cdc {
|
||||
struct usb_configuration_desc config;
|
||||
struct usb_interface_association_desc iad;
|
||||
struct usb_interface_desc hid_if;
|
||||
struct usb_hid_desc hid;
|
||||
struct usb_endpoint_desc hid_in;
|
||||
struct usb_endpoint_desc hid_out;
|
||||
struct usb_interface_desc cdc_control_if;
|
||||
struct usb_cdc_header_func_desc cdc_header;
|
||||
struct usb_cdc_callmgmt_func_desc cdc_callmgmt;
|
||||
@ -107,10 +111,6 @@ struct usb_config_hid_cdc {
|
||||
struct usb_interface_desc cdc_data_if;
|
||||
struct usb_endpoint_desc cdc_in;
|
||||
struct usb_endpoint_desc cdc_out;
|
||||
struct usb_interface_desc hid_if;
|
||||
struct usb_hid_desc hid;
|
||||
struct usb_endpoint_desc hid_in;
|
||||
struct usb_endpoint_desc hid_out;
|
||||
} __attribute__((packed));
|
||||
|
||||
static const struct usb_config_hid_cdc config_hid_cdc = {
|
||||
@ -129,87 +129,15 @@ static const struct usb_config_hid_cdc config_hid_cdc = {
|
||||
.bDescriptorType = USB_DESC_TYPE_IAD,
|
||||
.bFirstInterface = 0,
|
||||
.bInterfaceCount = 2,
|
||||
.bFunctionClass = USB_INTERFACE_CLASS_CDC, /* Communication */
|
||||
.bFunctionSubClass = USB_CDC_DESC_SUBTYPE_ABSTRACT_CTRL, /* Abstract Control Model */
|
||||
.bFunctionProtocol = 1, /* V.25ter, Common AT commands */
|
||||
.bFunctionClass = 2, /* Communication */
|
||||
.bFunctionSubClass = 2, /* Abstract Control Model */
|
||||
.bFunctionProtocol = 0, /* V.25ter, Common AT commands */
|
||||
.iInterface = 0,
|
||||
},
|
||||
.cdc_control_if = {
|
||||
.bLength = sizeof(struct usb_interface_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_INTERFACE,
|
||||
.bInterfaceNumber = 0,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 1,
|
||||
.bInterfaceClass = USB_INTERFACE_CLASS_CDC,
|
||||
.bInterfaceSubClass = USB_CDC_DESC_SUBTYPE_ABSTRACT_CTRL, /* Abstract Control Model */
|
||||
.nInterfaceProtocol = 1, /* V.25ter, Common AT commands */
|
||||
.iInterface = 0,
|
||||
},
|
||||
.cdc_header = {
|
||||
.bLength = sizeof(struct usb_cdc_header_func_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = USB_CDC_DESC_SUBTYPE_HEADER,
|
||||
.bcdCDC = htousbs(0x0110),
|
||||
},
|
||||
.cdc_callmgmt = {
|
||||
.bLength = sizeof(struct usb_cdc_callmgmt_func_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = USB_CDC_DESC_SUBTYPE_CALLMGMT,
|
||||
.bmCapabilities = 0x00, /* No call handling */
|
||||
.bDataInterface = 1,
|
||||
},
|
||||
.cdc_acm = {
|
||||
.bLength = sizeof(struct usb_cdc_acm_func_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = USB_CDC_DESC_SUBTYPE_ABSTRACT_CTRL,
|
||||
.bmCapabilities = 0x00,
|
||||
},
|
||||
.cdc_union = {
|
||||
.bLength = sizeof(struct usb_cdc_union_func_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = USB_CDC_DESC_SUBTYPE_UNION,
|
||||
.bMasterInterface = 0,
|
||||
.bSlaveInterface = 1,
|
||||
},
|
||||
.cdc_mgmt_in = {
|
||||
.bLength = sizeof(struct usb_endpoint_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = USB_EP_IN(2),
|
||||
.bmAttributes = USB_EP_ATTR_TT_INTERRUPT,
|
||||
.wMaxPacketSize = htousbs(PIOS_USB_BOARD_CDC_MGMT_LENGTH),
|
||||
.bInterval = 4, /* ms */
|
||||
},
|
||||
.cdc_data_if = {
|
||||
.bLength = sizeof(struct usb_interface_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_INTERFACE,
|
||||
.bInterfaceNumber = 1,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 2,
|
||||
.bInterfaceClass = USB_INTERFACE_CLASS_DATA,
|
||||
.bInterfaceSubClass = 0,
|
||||
.nInterfaceProtocol = 0, /* No class specific protocol */
|
||||
.iInterface = 0,
|
||||
},
|
||||
.cdc_in = {
|
||||
.bLength = sizeof(struct usb_endpoint_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = USB_EP_IN(3),
|
||||
.bmAttributes = USB_EP_ATTR_TT_BULK,
|
||||
.wMaxPacketSize = htousbs(PIOS_USB_BOARD_CDC_DATA_LENGTH),
|
||||
.bInterval = 0, /* ms */
|
||||
},
|
||||
.cdc_out = {
|
||||
.bLength = sizeof(struct usb_endpoint_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = USB_EP_OUT(3),
|
||||
.bmAttributes = USB_EP_ATTR_TT_BULK, /* Bulk */
|
||||
.wMaxPacketSize = htousbs(PIOS_USB_BOARD_CDC_DATA_LENGTH),
|
||||
.bInterval = 0, /* ms */
|
||||
},
|
||||
.hid_if = {
|
||||
.bLength = sizeof(struct usb_interface_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_INTERFACE,
|
||||
.bInterfaceNumber = 2,
|
||||
.bInterfaceNumber = 0,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 2,
|
||||
.bInterfaceClass = USB_INTERFACE_CLASS_HID,
|
||||
@ -242,6 +170,78 @@ static const struct usb_config_hid_cdc config_hid_cdc = {
|
||||
.wMaxPacketSize = htousbs(PIOS_USB_BOARD_HID_DATA_LENGTH),
|
||||
.bInterval = 4, /* ms */
|
||||
},
|
||||
.cdc_control_if = {
|
||||
.bLength = sizeof(struct usb_interface_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_INTERFACE,
|
||||
.bInterfaceNumber = 1,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 1,
|
||||
.bInterfaceClass = USB_INTERFACE_CLASS_CDC,
|
||||
.bInterfaceSubClass = 2, /* Abstract Control Model */
|
||||
.nInterfaceProtocol = 1, /* V.25ter, Common AT commands */
|
||||
.iInterface = 0,
|
||||
},
|
||||
.cdc_header = {
|
||||
.bLength = sizeof(struct usb_cdc_header_func_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = USB_CDC_DESC_SUBTYPE_HEADER,
|
||||
.bcdCDC = htousbs(0x0110),
|
||||
},
|
||||
.cdc_callmgmt = {
|
||||
.bLength = sizeof(struct usb_cdc_callmgmt_func_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = USB_CDC_DESC_SUBTYPE_CALLMGMT,
|
||||
.bmCapabilities = 0x00, /* No call handling */
|
||||
.bDataInterface = 2,
|
||||
},
|
||||
.cdc_acm = {
|
||||
.bLength = sizeof(struct usb_cdc_acm_func_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = USB_CDC_DESC_SUBTYPE_ABSTRACT_CTRL,
|
||||
.bmCapabilities = 0,
|
||||
},
|
||||
.cdc_union = {
|
||||
.bLength = sizeof(struct usb_cdc_union_func_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_CLASS_SPECIFIC,
|
||||
.bDescriptorSubType = USB_CDC_DESC_SUBTYPE_UNION,
|
||||
.bMasterInterface = 1,
|
||||
.bSlaveInterface = 2,
|
||||
},
|
||||
.cdc_mgmt_in = {
|
||||
.bLength = sizeof(struct usb_endpoint_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = USB_EP_IN(2),
|
||||
.bmAttributes = USB_EP_ATTR_TT_INTERRUPT,
|
||||
.wMaxPacketSize = htousbs(PIOS_USB_BOARD_CDC_MGMT_LENGTH),
|
||||
.bInterval = 4, /* ms */
|
||||
},
|
||||
.cdc_data_if = {
|
||||
.bLength = sizeof(struct usb_interface_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_INTERFACE,
|
||||
.bInterfaceNumber = 2,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 2,
|
||||
.bInterfaceClass = USB_INTERFACE_CLASS_DATA,
|
||||
.bInterfaceSubClass = 0,
|
||||
.nInterfaceProtocol = 0, /* No class specific protocol */
|
||||
.iInterface = 0,
|
||||
},
|
||||
.cdc_in = {
|
||||
.bLength = sizeof(struct usb_endpoint_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = USB_EP_IN(3),
|
||||
.bmAttributes = USB_EP_ATTR_TT_BULK,
|
||||
.wMaxPacketSize = htousbs(PIOS_USB_BOARD_CDC_DATA_LENGTH),
|
||||
.bInterval = 0, /* ms */
|
||||
},
|
||||
.cdc_out = {
|
||||
.bLength = sizeof(struct usb_endpoint_desc),
|
||||
.bDescriptorType = USB_DESC_TYPE_ENDPOINT,
|
||||
.bEndpointAddress = USB_EP_OUT(3),
|
||||
.bmAttributes = USB_EP_ATTR_TT_BULK, /* Bulk */
|
||||
.wMaxPacketSize = htousbs(PIOS_USB_BOARD_CDC_DATA_LENGTH),
|
||||
.bInterval = 0, /* ms */
|
||||
},
|
||||
};
|
||||
|
||||
int32_t PIOS_USB_DESC_HID_CDC_Init(void)
|
||||
|
@ -304,7 +304,7 @@ static RESULT PIOS_USBHOOK_Data_Setup(uint8_t RequestNo)
|
||||
switch (Type_Recipient) {
|
||||
case (STANDARD_REQUEST | INTERFACE_RECIPIENT):
|
||||
switch (pInformation->USBwIndex0) {
|
||||
case 2: /* HID Interface */
|
||||
case 0: /* HID Interface */
|
||||
switch (RequestNo) {
|
||||
case GET_DESCRIPTOR:
|
||||
switch (pInformation->USBwValue1) {
|
||||
@ -321,7 +321,7 @@ static RESULT PIOS_USBHOOK_Data_Setup(uint8_t RequestNo)
|
||||
|
||||
case (CLASS_REQUEST | INTERFACE_RECIPIENT):
|
||||
switch (pInformation->USBwIndex0) {
|
||||
case 2: /* HID Interface */
|
||||
case 0: /* HID Interface */
|
||||
switch (RequestNo) {
|
||||
case USB_HID_REQ_GET_PROTOCOL:
|
||||
CopyRoutine = PIOS_USBHOOK_GetProtocolValue;
|
||||
@ -330,7 +330,7 @@ static RESULT PIOS_USBHOOK_Data_Setup(uint8_t RequestNo)
|
||||
|
||||
break;
|
||||
#if defined(PIOS_INCLUDE_USB_CDC)
|
||||
case 0: /* CDC Call Control Interface */
|
||||
case 1: /* CDC Call Control Interface */
|
||||
switch (RequestNo) {
|
||||
case USB_CDC_REQ_GET_LINE_CODING:
|
||||
CopyRoutine = PIOS_USB_CDC_GetLineCoding;
|
||||
@ -339,7 +339,7 @@ static RESULT PIOS_USBHOOK_Data_Setup(uint8_t RequestNo)
|
||||
|
||||
break;
|
||||
|
||||
case 1: /* CDC Data Interface */
|
||||
case 2: /* CDC Data Interface */
|
||||
switch (RequestNo) {
|
||||
case 0:
|
||||
break;
|
||||
@ -376,7 +376,7 @@ static RESULT PIOS_USBHOOK_NoData_Setup(uint8_t RequestNo)
|
||||
switch (Type_Recipient) {
|
||||
case (CLASS_REQUEST | INTERFACE_RECIPIENT):
|
||||
switch (pInformation->USBwIndex0) {
|
||||
case 2: /* HID */
|
||||
case 0: /* HID */
|
||||
switch (RequestNo) {
|
||||
case USB_HID_REQ_SET_PROTOCOL:
|
||||
return PIOS_USBHOOK_SetProtocol();
|
||||
@ -386,7 +386,7 @@ static RESULT PIOS_USBHOOK_NoData_Setup(uint8_t RequestNo)
|
||||
break;
|
||||
|
||||
#if defined(PIOS_INCLUDE_USB_CDC)
|
||||
case 0: /* CDC Call Control Interface */
|
||||
case 1: /* CDC Call Control Interface */
|
||||
switch (RequestNo) {
|
||||
case USB_CDC_REQ_SET_LINE_CODING:
|
||||
return PIOS_USB_CDC_SetLineCoding();
|
||||
|
@ -1,32 +0,0 @@
|
||||
[Version]
|
||||
Signature="$Windows NT$"
|
||||
Class=Ports
|
||||
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
|
||||
Provider=%ProviderName%
|
||||
DriverVer=10/15/2009,1.0.0.0
|
||||
|
||||
[MANUFACTURER]
|
||||
%ProviderName%=DeviceList, NTx86, NTamd64
|
||||
|
||||
[DeviceList.NTx86]
|
||||
%CopterControl%= DriverInstall,USB\VID_20A0&PID_415b&MI_00
|
||||
|
||||
[DeviceList.NTamd64]
|
||||
%CopterControl%= DriverInstall,USB\VID_20A0&PID_415b&MI_00
|
||||
|
||||
[DriverInstall]
|
||||
include=mdmcpq.inf
|
||||
CopyFiles=FakeModemCopyFileSection
|
||||
AddReg=LowerFilterAddReg,SerialPropPageAddReg
|
||||
|
||||
[DriverInstall.Services]
|
||||
include = mdmcpq.inf
|
||||
AddService = usbser, 0x00000002, LowerFilter_Service_Inst
|
||||
|
||||
; This adds the serial port property tab to the device properties dialog
|
||||
[SerialPropPageAddReg]
|
||||
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
|
||||
|
||||
[Strings]
|
||||
ProviderName = "CDC Driver"
|
||||
CopterControl = "OpenPilot CDC Driver"
|
@ -1263,21 +1263,20 @@ static const struct pios_usb_cfg pios_usb_main_cfg_cc3d = {
|
||||
#include <pios_usb_hid_priv.h>
|
||||
|
||||
const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
|
||||
.data_if = 2,
|
||||
.data_if = 0,
|
||||
.data_rx_ep = 1,
|
||||
.data_tx_ep = 1,
|
||||
};
|
||||
|
||||
#endif /* PIOS_INCLUDE_USB_HID */
|
||||
|
||||
#if defined(PIOS_INCLUDE_USB_CDC)
|
||||
#include <pios_usb_cdc_priv.h>
|
||||
|
||||
const struct pios_usb_cdc_cfg pios_usb_cdc_cfg = {
|
||||
.ctrl_if = 0,
|
||||
.ctrl_if = 1,
|
||||
.ctrl_tx_ep = 2,
|
||||
|
||||
.data_if = 1,
|
||||
.data_if = 2,
|
||||
.data_rx_ep = 3,
|
||||
.data_tx_ep = 3,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user