Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dtdaq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniele Nicolodi
dtdaq
Commits
1e44d5d4
Commit
1e44d5d4
authored
2 years ago
by
Daniele Nicolodi
Browse files
Options
Downloads
Patches
Plain Diff
Improve error reporting when no device is found
parent
1e3a35e9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dtdaq/__main__.py
+8
-3
8 additions, 3 deletions
dtdaq/__main__.py
dtdaq/enumerate.py
+8
-3
8 additions, 3 deletions
dtdaq/enumerate.py
with
16 additions
and
6 deletions
dtdaq/__main__.py
+
8
−
3
View file @
1e44d5d4
...
...
@@ -6,7 +6,7 @@ import time
import
click
import
colorama
from
.
dtdaq
import
DTD
aq
from
.
import
dtd
aq
@click.command
()
...
...
@@ -18,8 +18,13 @@ from .dtdaq import DTDaq
def
main
(
device
,
fsampl
,
channel
,
gain
,
filename
):
colorama
.
init
()
daq
=
DTDaq
(
device
.
encode
(
'
ascii
'
))
print
(
f
'
{
daq
.
name
}
{
daq
.
version
}
0x
{
daq
.
hwinfo
.
serial
:
X
}
'
)
try
:
daq
=
dtdaq
.
DTDaq
(
device
.
encode
(
'
ascii
'
))
print
(
f
'
{
daq
.
name
}
{
daq
.
version
}
0x
{
daq
.
hwinfo
.
serial
:
X
}
'
)
except
dtdaq
.
DTDaqError
as
exc
:
if
exc
.
errno
==
dtdaq
.
errno
.
OLCANNOTOPENDRIVER
:
return
click
.
echo
(
f
'
Error:
{
exc
.
message
}
. Device
"
{
device
}
"
not found.
'
,
err
=
True
)
raise
if
len
(
gain
)
==
1
:
gain
=
list
(
gain
)
*
len
(
channel
)
...
...
This diff is collapsed.
Click to expand it.
dtdaq/enumerate.py
+
8
−
3
View file @
1e44d5d4
import
click
from
.
dtdaq
import
enum_boards
from
.
import
dtdaq
@click.command
()
def
main
():
for
board
in
enum_boards
():
print
(
board
.
name
)
try
:
for
board
in
dtdaq
.
enumerate_devices
():
print
(
board
.
name
)
except
dtdaq
.
DTDaqError
as
exc
:
if
exc
.
errno
==
dtdaq
.
errno
.
OLNOBOARDSINSTALLED
:
return
print
(
f
'
{
exc
.
message
}
.
'
)
raise
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment