Open wimmatthijs opened 1 year ago
Does this work?
dev._service(b'install', b'<package.apk>')
Hello. I'm trying the next on a Quest 2 using macOS:
result = device._service(
b"install",
b"/Users/ulysess/Documents/test/test.apk",
)
I get the next issue (running with both sudo or not):
Traceback (most recent call last):
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/adb_shell/transport/usb_transport.py", line 283, in bulk_read
return bytes(self._transport.bulkRead(self._read_endpoint, numbytes, timeout=self._timeout_ms(transport_timeout_s)))
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/usb1/__init__.py", line 1412, in bulkRead
transferred = self._bulkTransfer(endpoint, data, length, timeout)
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/usb1/__init__.py", line 1358, in _bulkTransfer
mayRaiseUSBError(libusb1.libusb_bulk_transfer(
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/usb1/__init__.py", line 127, in mayRaiseUSBError
__raiseUSBError(value)
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/usb1/__init__.py", line 119, in raiseUSBError
raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
usb1.USBErrorTimeout: LIBUSB_ERROR_TIMEOUT [-7]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ulysess/Documents/sc/test_adb/main.py", line 235, in <module>
main()
File "/Users/ulysess/Documents/sc/test_adb/main.py", line 203, in main
install_apk(args.install, destination_full_path)
File "/Users/ulysess/Documents/sc/test_adb/main.py", line 164, in install_apk
result = device._service(
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/adb_shell/adb_device.py", line 710, in _service
return b''.join(self._streaming_command(service, command, transport_timeout_s, read_timeout_s, timeout_s)).decode('utf8', _DECODE_ERRORS)
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/adb_shell/adb_device.py", line 1288, in _streaming_command
adb_info = self._open(b'%s:%s' % (service, command), transport_timeout_s, read_timeout_s, timeout_s)
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/adb_shell/adb_device.py", line 1186, in _open
_, adb_info.remote_id, _, _ = self._io_manager.read([constants.OKAY], adb_info)
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/adb_shell/adb_device.py", line 339, in read
cmd, arg0, arg1, data = self._read_packet_from_device(adb_info)
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/adb_shell/adb_device.py", line 486, in _read_packet_from_device
msg = self._read_bytes_from_device(constants.MESSAGE_SIZE, adb_info)
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/adb_shell/adb_device.py", line 442, in _read_bytes_from_device
temp = self._transport.bulk_read(length, adb_info.transport_timeout_s)
File "/Users/ulysess/Documents/sc/test_adb/.venv/lib/python3.9/site-packages/adb_shell/transport/usb_transport.py", line 285, in bulk_read
raise exceptions.UsbReadFailedError('Could not receive data from %s (timeout %sms)' % (self.usb_info, self._timeout_ms(transport_timeout_s)), e)
adb_shell.exceptions.UsbReadFailedError: Could not receive data from first 1WMHH812AS9999 (timeout 10000ms): LIBUSB_ERROR_TIMEOUT [-7]
The log I get: messages.log
@jmcerrejon @JeffLIrion I worked around the issue by pushing the apk myself and doing a shell pm install command..... So for now my workaround works, i just thought it would be a nice feature to have in this otherwise very nice and useful package.
Yeah, that's the way to proceed now, but It's a great feature to take into account. 😉
I'm using this library for testing purposes. Installing the apk to test through adb would be very nice feature to have. cfr
adb install <package.apk>