Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Mock Turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Mock Turtle
Commits
c69fc100
Commit
c69fc100
authored
Apr 20, 2018
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:py: use the proper strerror for Mock Turtle
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
e375d87b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
PyMockTurtle.py
software/lib/PyMockTurtle/PyMockTurtle/PyMockTurtle.py
+8
-2
No files found.
software/lib/PyMockTurtle/PyMockTurtle/PyMockTurtle.py
View file @
c69fc100
...
...
@@ -156,6 +156,10 @@ class TrtlDevice(object):
self
.
libtrtl
.
trtl_open_by_id
.
argtypes
=
[
c_uint
]
self
.
libtrtl
.
trtl_open_by_id
.
restype
=
c_void_p
self
.
libtrtl
.
trtl_open_by_id
.
errcheck
=
self
.
__errcheck_pointer
# ERROR
self
.
libtrtl
.
trtl_strerror
.
argtypes
=
[
c_int
]
self
.
libtrtl
.
trtl_strerror
.
restype
=
c_char_p
self
.
libtrtl
.
trtl_open_by_id
.
errcheck
=
self
.
__errcheck_pointer
# SHM READ
self
.
libtrtl
.
trtl_smem_read
.
argtypes
=
[
c_void_p
,
c_uint
,
POINTER
(
c_int
),
c_size_t
,
...
...
@@ -252,7 +256,8 @@ class TrtlDevice(object):
def
__errcheck_pointer
(
self
,
ret
,
func
,
args
):
"""Generic error handler for functions returning pointers"""
if
ret
is
None
:
raise
OSError
(
get_errno
(),
os
.
strerror
(
get_errno
()),
""
)
raise
OSError
(
get_errno
(),
self
.
libtrtl
.
trtl_strerror
(
get_errno
()),
""
)
else
:
return
ret
...
...
@@ -260,7 +265,8 @@ class TrtlDevice(object):
"""Generic error checker for functions returning 0 as success
and -1 as error"""
if
ret
<
0
:
raise
OSError
(
get_errno
(),
os
.
strerror
(
get_errno
()),
""
)
raise
OSError
(
get_errno
(),
self
.
libtrtl
.
trtl_strerror
(
get_errno
()),
""
)
else
:
return
ret
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment