Handle permission denied errors returned by firmware revision 1.0.02.01300. Version bump.

This commit is contained in:
Kovid Goyal 2007-02-09 20:40:52 +00:00
parent 509fdf081b
commit 2379b516c5
4 changed files with 13 additions and 2 deletions

View File

@ -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 <kovid@kovidgoyal.net>"

View File

@ -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))

Binary file not shown.

View File

@ -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) """