Skip to content

Commit

Permalink
Improve error message if device does not support apps
Browse files Browse the repository at this point in the history
  • Loading branch information
ma1co committed Apr 8, 2022
1 parent 7728b39 commit 0c1097d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pmca/commands/usb.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ def printStatus(status):
print('%s %d%%' % (status.message, status.percent))


def switchToAppInstaller(dev):
"""Switches a camera in MTP mode to app installation mode"""
print('Switching to app install mode')
SonyExtCmdCamera(dev).switchToAppInstaller()


appListCache = None
def listApps(enableCache=False):
global appListCache
Expand Down Expand Up @@ -281,7 +275,12 @@ def installCommand(driverName=None, apkFile=None, appPackage=None, outFile=None)
with importDriver(driverName) as driver:
device = getDevice(driver)
if device and isinstance(device, SonyExtCmdDevice):
switchToAppInstaller(device)
print('Switching to app install mode')
try:
SonyExtCmdCamera(device).switchToAppInstaller()
except InvalidCommandException:
print('Error: This device does not support apps')
return
device = None

print('Waiting for camera to switch...')
Expand Down

0 comments on commit 0c1097d

Please sign in to comment.