| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/usb/mojo/type_converters.h" | 5 #include "device/usb/mojo/type_converters.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 NOTREACHED(); | 131 NOTREACHED(); |
| 132 return device::usb::EndpointType::BULK; | 132 return device::usb::EndpointType::BULK; |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 // static | 136 // static |
| 137 device::usb::EndpointInfoPtr | 137 device::usb::EndpointInfoPtr |
| 138 TypeConverter<device::usb::EndpointInfoPtr, device::UsbEndpointDescriptor>:: | 138 TypeConverter<device::usb::EndpointInfoPtr, device::UsbEndpointDescriptor>:: |
| 139 Convert(const device::UsbEndpointDescriptor& endpoint) { | 139 Convert(const device::UsbEndpointDescriptor& endpoint) { |
| 140 device::usb::EndpointInfoPtr info = device::usb::EndpointInfo::New(); | 140 device::usb::EndpointInfoPtr info = device::usb::EndpointInfo::New(); |
| 141 info->endpoint_number = endpoint.address; | 141 info->endpoint_number = endpoint.address & 0xf; |
| 142 info->direction = | 142 info->direction = |
| 143 ConvertTo<device::usb::TransferDirection>(endpoint.direction); | 143 ConvertTo<device::usb::TransferDirection>(endpoint.direction); |
| 144 info->type = ConvertTo<device::usb::EndpointType>(endpoint.transfer_type); | 144 info->type = ConvertTo<device::usb::EndpointType>(endpoint.transfer_type); |
| 145 info->packet_size = static_cast<uint32_t>(endpoint.maximum_packet_size); | 145 info->packet_size = static_cast<uint32_t>(endpoint.maximum_packet_size); |
| 146 return info; | 146 return info; |
| 147 } | 147 } |
| 148 | 148 |
| 149 // static | 149 // static |
| 150 device::usb::AlternateInterfaceInfoPtr | 150 device::usb::AlternateInterfaceInfoPtr |
| 151 TypeConverter<device::usb::AlternateInterfaceInfoPtr, | 151 TypeConverter<device::usb::AlternateInterfaceInfoPtr, |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 Convert(const device::UsbDeviceHandle::IsochronousPacket& packet) { | 279 Convert(const device::UsbDeviceHandle::IsochronousPacket& packet) { |
| 280 device::usb::IsochronousPacketPtr info = | 280 device::usb::IsochronousPacketPtr info = |
| 281 device::usb::IsochronousPacket::New(); | 281 device::usb::IsochronousPacket::New(); |
| 282 info->length = packet.length; | 282 info->length = packet.length; |
| 283 info->transferred_length = packet.transferred_length; | 283 info->transferred_length = packet.transferred_length; |
| 284 info->status = mojo::ConvertTo<device::usb::TransferStatus>(packet.status); | 284 info->status = mojo::ConvertTo<device::usb::TransferStatus>(packet.status); |
| 285 return info; | 285 return info; |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace mojo | 288 } // namespace mojo |
| OLD | NEW |