Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Programmable RF Attenuator
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
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Programmable RF Attenuator
Commits
e0bc7fa4
Commit
e0bc7fa4
authored
Apr 27, 2023
by
Dimitris Lampridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli: avoid hard-coding CERN VID and PID
parent
ed89ad4c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
oattnusbtest
software/lib/oattnusbtest
+9
-5
No files found.
software/lib/oattnusbtest
View file @
e0bc7fa4
...
...
@@ -28,6 +28,9 @@ class DevArray(Structure):
class
OattnUsbTest
(
cmd
.
Cmd
):
VENDOR_ID
=
0x1556
# CERN USB Vendor ID
DEVICE_ID
=
0x0443
# oau USB Device ID
attn_values
=
{
'-40dB'
:
0
,
'-20dB'
:
1
,
...
...
@@ -50,7 +53,7 @@ class OattnUsbTest(cmd.Cmd):
self
.
nchannels
=
None
self
.
load_solib
()
self
.
fill_devarray
(
)
self
.
devices
=
self
.
fill_devarray
(
self
.
VENDOR_ID
,
self
.
DEVICE_ID
)
def
load_solib
(
self
):
"""try to load attn dyn library from script dir or ../lib."""
...
...
@@ -71,15 +74,15 @@ class OattnUsbTest(cmd.Cmd):
exit
()
def
fill_devarray
(
self
):
def
fill_devarray
(
self
,
vid
,
pid
):
self
.
api
.
oattnusb_get_devarray
.
restype
=
POINTER
(
DevArray
)
self
.
devarray
=
self
.
api
.
oattnusb_get_devarray
(
0x1556
,
0x0443
)
self
.
devarray
=
self
.
api
.
oattnusb_get_devarray
(
vid
,
pid
)
ndevs
=
self
.
devarray
.
contents
.
ndevs
devs
=
self
.
devarray
.
contents
.
devs
self
.
devices
=
[]
devices
=
[]
for
i
in
range
(
ndevs
):
dev
=
devs
[
i
]
self
.
devices
.
append
({
devices
.
append
({
'lun'
:
dev
.
lun
,
'busnum'
:
str
(
dev
.
busnum
,
'utf8'
),
'devnum'
:
str
(
dev
.
devnum
,
'utf8'
),
...
...
@@ -88,6 +91,7 @@ class OattnUsbTest(cmd.Cmd):
'devno'
:
str
(
dev
.
devno
,
'utf8'
),
'serial'
:
str
(
dev
.
serial
,
'utf8'
),
'path'
:
str
(
dev
.
path
,
'utf8'
)})
return
devices
def
do_list
(
self
,
arg
):
"""list devices and their access methods."""
...
...
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