diff --git a/src/libprs500/__init__.py b/src/libprs500/__init__.py index 5f9d52e201..576c8601f2 100644 --- a/src/libprs500/__init__.py +++ b/src/libprs500/__init__.py @@ -37,7 +37,7 @@ You may have to adjust the GROUP and the location of the rules file to suit your distribution. """ -__version__ = "0.3.8" +__version__ = "0.3.9" __docformat__ = "epytext" __author__ = "Kovid Goyal " diff --git a/src/libprs500/communicate.py b/src/libprs500/communicate.py index 5725b725d5..4dbf0be947 100755 --- a/src/libprs500/communicate.py +++ b/src/libprs500/communicate.py @@ -427,7 +427,7 @@ class PRS500Device(Device): response_type=ListResponse) data = self._bulk_read(0x28, data_type=FileProperties, \ command_number=PathQuery.NUMBER)[0] - if path.endswith("/"): + if path.endswith('/') and path != '/': path = path[:-1] if res.path_not_found : raise PathError(path + " does not exist on device") @@ -435,6 +435,8 @@ class PRS500Device(Device): raise PathError(path + " is not a valid path") if res.is_unmounted: raise PathError(path + " is not mounted") + if res.permission_denied: + raise PathError('Permission denied for: ' + path) if res.code not in (0, PathResponseCodes.IS_FILE): raise PathError(path + " has an unknown error. Code: " + \ hex(res.code)) diff --git a/src/libprs500/lrf/BBeBook-0.2.jar b/src/libprs500/lrf/BBeBook-0.2.jar index 5075281029..1363a8bc1e 100644 Binary files a/src/libprs500/lrf/BBeBook-0.2.jar and b/src/libprs500/lrf/BBeBook-0.2.jar differ diff --git a/src/libprs500/prstypes.py b/src/libprs500/prstypes.py index 8faf377e5f..287856bfc9 100755 --- a/src/libprs500/prstypes.py +++ b/src/libprs500/prstypes.py @@ -57,6 +57,7 @@ class PathResponseCodes(object): INVALID = 0xfffffff9 IS_FILE = 0xffffffd2 HAS_CHILDREN = 0xffffffcc + PERMISSION_DENIED = 0xffffffd6 class TransferBuffer(list): @@ -675,6 +676,7 @@ class ListResponse(Response): IS_UNMOUNTED = 0xffffffc8 IS_EOL = 0xfffffffa #: There are no more entries in the list PATH_NOT_FOUND = 0xffffffd7 #: Queried path is not found + PERMISSION_DENIED = 0xffffffd6 #: Permission denied @apply def is_file(): @@ -697,6 +699,13 @@ class ListResponse(Response): return self.code == ListResponse.PATH_NOT_FOUND return property(doc=doc, fget=fget) + @apply + def permission_denied(): + doc = """ True iff permission is denied for path operations """ + def fget(self): + return self.code == ListResponse.PERMISSION_DENIED + return property(doc=doc, fget=fget) + @apply def is_unmounted(): doc = """ True iff queried path is unmounted (i.e. removed storage card) """