| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/usb_device_handle_impl.h" | 5 #include "device/usb/usb_device_handle_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 value, | 557 value, |
| 558 index, | 558 index, |
| 559 static_cast<int16>(length)); | 559 static_cast<int16>(length)); |
| 560 libusb_fill_control_transfer(transfer, | 560 libusb_fill_control_transfer(transfer, |
| 561 handle_, | 561 handle_, |
| 562 reinterpret_cast<uint8*>(resized_buffer->data()), | 562 reinterpret_cast<uint8*>(resized_buffer->data()), |
| 563 &UsbDeviceHandleImpl::PlatformTransferCallback, | 563 &UsbDeviceHandleImpl::PlatformTransferCallback, |
| 564 this, | 564 this, |
| 565 timeout); | 565 timeout); |
| 566 | 566 |
| 567 PostOrSubmitTransfer( | 567 PostOrSubmitTransfer(transfer, |
| 568 transfer, USB_TRANSFER_CONTROL, resized_buffer, resized_length, callback); | 568 USB_TRANSFER_CONTROL, |
| 569 resized_buffer.get(), |
| 570 resized_length, |
| 571 callback); |
| 569 } | 572 } |
| 570 | 573 |
| 571 void UsbDeviceHandleImpl::BulkTransfer(const UsbEndpointDirection direction, | 574 void UsbDeviceHandleImpl::BulkTransfer(const UsbEndpointDirection direction, |
| 572 const uint8 endpoint, | 575 const uint8 endpoint, |
| 573 net::IOBuffer* buffer, | 576 net::IOBuffer* buffer, |
| 574 const size_t length, | 577 const size_t length, |
| 575 const unsigned int timeout, | 578 const unsigned int timeout, |
| 576 const UsbTransferCallback& callback) { | 579 const UsbTransferCallback& callback) { |
| 577 if (!device_) { | 580 if (!device_) { |
| 578 callback.Run(USB_TRANSFER_DISCONNECT, buffer, 0); | 581 callback.Run(USB_TRANSFER_DISCONNECT, buffer, 0); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 // Attempt-release all the interfaces. | 759 // Attempt-release all the interfaces. |
| 757 // It will be retained until the transfer cancellation is finished. | 760 // It will be retained until the transfer cancellation is finished. |
| 758 claimed_interfaces_.clear(); | 761 claimed_interfaces_.clear(); |
| 759 | 762 |
| 760 // Cannot close device handle here. Need to wait for libusb_cancel_transfer to | 763 // Cannot close device handle here. Need to wait for libusb_cancel_transfer to |
| 761 // finish. | 764 // finish. |
| 762 device_ = NULL; | 765 device_ = NULL; |
| 763 } | 766 } |
| 764 | 767 |
| 765 } // namespace device | 768 } // namespace device |
| OLD | NEW |