OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_usbfs.h" | 5 #include "device/usb/usb_device_handle_usbfs.h" |
6 | 6 |
7 #if defined(OS_ANDROID) && __ANDROID_API__ < 21 | 7 #if defined(OS_ANDROID) && __ANDROID_API__ < 21 |
8 #include <linux/usb_ch9.h> | 8 #include <linux/usb_ch9.h> |
9 #else | 9 #else |
10 #include <linux/usb/ch9.h> | 10 #include <linux/usb/ch9.h> |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 this, configuration_value, callback)); | 362 this, configuration_value, callback)); |
363 } | 363 } |
364 | 364 |
365 void UsbDeviceHandleUsbfs::ClaimInterface(int interface_number, | 365 void UsbDeviceHandleUsbfs::ClaimInterface(int interface_number, |
366 const ResultCallback& callback) { | 366 const ResultCallback& callback) { |
367 if (!device_) { | 367 if (!device_) { |
368 task_runner_->PostTask(FROM_HERE, base::Bind(callback, false)); | 368 task_runner_->PostTask(FROM_HERE, base::Bind(callback, false)); |
369 return; | 369 return; |
370 } | 370 } |
371 | 371 |
372 if (ContainsKey(interfaces_, interface_number)) { | 372 if (base::ContainsKey(interfaces_, interface_number)) { |
373 USB_LOG(DEBUG) << "Interface " << interface_number << " already claimed."; | 373 USB_LOG(DEBUG) << "Interface " << interface_number << " already claimed."; |
374 task_runner_->PostTask(FROM_HERE, base::Bind(callback, false)); | 374 task_runner_->PostTask(FROM_HERE, base::Bind(callback, false)); |
375 return; | 375 return; |
376 } | 376 } |
377 | 377 |
378 // It appears safe to assume that this ioctl will not block. | 378 // It appears safe to assume that this ioctl will not block. |
379 int rc = HANDLE_EINTR( | 379 int rc = HANDLE_EINTR( |
380 ioctl(fd_.get(), USBDEVFS_CLAIMINTERFACE, &interface_number)); | 380 ioctl(fd_.get(), USBDEVFS_CLAIMINTERFACE, &interface_number)); |
381 if (rc) { | 381 if (rc) { |
382 USB_PLOG(DEBUG) << "Failed to claim interface " << interface_number; | 382 USB_PLOG(DEBUG) << "Failed to claim interface " << interface_number; |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 packets[i].transferred_length = 0; | 852 packets[i].transferred_length = 0; |
853 packets[i].status = status; | 853 packets[i].status = status; |
854 } | 854 } |
855 transfer->RunIsochronousCallback(packets); | 855 transfer->RunIsochronousCallback(packets); |
856 } else { | 856 } else { |
857 transfer->RunCallback(status, 0); | 857 transfer->RunCallback(status, 0); |
858 } | 858 } |
859 } | 859 } |
860 | 860 |
861 } // namespace device | 861 } // namespace device |
OLD | NEW |