| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/usb/usb_device.h" | 5 #include "chrome/browser/usb/usb_device.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
| 9 #include "chrome/browser/usb/usb_service.h" | 9 #include "chrome/browser/usb/usb_service.h" |
| 10 #include "third_party/libusb/libusb.h" | 10 #include "third_party/libusb/src/libusb/libusb.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 static uint8 ConvertTransferDirection( | 14 static uint8 ConvertTransferDirection( |
| 15 const UsbDevice::TransferDirection direction) { | 15 const UsbDevice::TransferDirection direction) { |
| 16 switch (direction) { | 16 switch (direction) { |
| 17 case UsbDevice::INBOUND: | 17 case UsbDevice::INBOUND: |
| 18 return LIBUSB_ENDPOINT_IN; | 18 return LIBUSB_ENDPOINT_IN; |
| 19 case UsbDevice::OUTBOUND: | 19 case UsbDevice::OUTBOUND: |
| 20 return LIBUSB_ENDPOINT_OUT; | 20 return LIBUSB_ENDPOINT_OUT; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 transfer.buffer = buffer; | 309 transfer.buffer = buffer; |
| 310 transfer.length = length; | 310 transfer.length = length; |
| 311 transfer.callback = callback; | 311 transfer.callback = callback; |
| 312 | 312 |
| 313 { | 313 { |
| 314 base::AutoLock lock(lock_); | 314 base::AutoLock lock(lock_); |
| 315 transfers_[handle] = transfer; | 315 transfers_[handle] = transfer; |
| 316 libusb_submit_transfer(handle); | 316 libusb_submit_transfer(handle); |
| 317 } | 317 } |
| 318 } | 318 } |
| OLD | NEW |