| OLD | NEW |
| 1 # Copyright 2014 Google Inc. All rights reserved. | 1 # Copyright 2014 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 # See the License for the specific language governing permissions and | 12 # See the License for the specific language governing permissions and |
| 13 # limitations under the License. | 13 # limitations under the License. |
| 14 """Common code for ADB and Fastboot. | 14 """Common code for ADB and Fastboot. |
| 15 | 15 |
| 16 Common usb browsing, and usb communication. | 16 Common usb browsing, and usb communication. |
| 17 """ | 17 """ |
| 18 import logging | 18 import logging |
| 19 import socket | 19 import socket |
| 20 import threading | 20 import threading |
| 21 import weakref | 21 import weakref |
| 22 | 22 |
| 23 import libusb1 | 23 from python_libusb1 import libusb1 |
| 24 import usb1 | 24 from python_libusb1 import usb1 |
| 25 | 25 |
| 26 import usb_exceptions | 26 import usb_exceptions |
| 27 | 27 |
| 28 DEFAULT_TIMEOUT_MS = 1000 | 28 DEFAULT_TIMEOUT_MS = 1000 |
| 29 | 29 |
| 30 _LOG = logging.getLogger('android_usb') | 30 _LOG = logging.getLogger('android_usb') |
| 31 | 31 |
| 32 | 32 |
| 33 def GetInterface(setting): | 33 def GetInterface(setting): |
| 34 """Get the class, subclass, and protocol for the given USB setting.""" | 34 """Get the class, subclass, and protocol for the given USB setting.""" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 return self._connection.sendall(data) | 300 return self._connection.sendall(data) |
| 301 | 301 |
| 302 def BulkRead(self, numbytes, timeout=None): | 302 def BulkRead(self, numbytes, timeout=None): |
| 303 return self._connection.recv(numbytes) | 303 return self._connection.recv(numbytes) |
| 304 | 304 |
| 305 def Timeout(self, timeout_ms): | 305 def Timeout(self, timeout_ms): |
| 306 return timeout_ms | 306 return timeout_ms |
| 307 | 307 |
| 308 def Close(self): | 308 def Close(self): |
| 309 return self._connection.close() | 309 return self._connection.close() |
| OLD | NEW |