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
f9d1e06f
Commit
f9d1e06f
authored
Nov 05, 2021
by
Juan David González Cobas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: open by serial number
parent
5e7c1b3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
liboasis-usb-att.c
software/lib/liboasis-usb-att.c
+17
-9
liboasis-usb-att.h
software/lib/liboasis-usb-att.h
+2
-2
No files found.
software/lib/liboasis-usb-att.c
View file @
f9d1e06f
...
...
@@ -40,7 +40,7 @@ static struct {
};
int
oau_att_open
(
int
lun
)
int
oau_att_open
(
char
*
serial
)
{
int
ret
;
...
...
@@ -56,18 +56,26 @@ int oau_att_open(int lun)
return
-
ENOMEM
;
}
if
((
ret
=
ftdi_usb_open
(
ctx
->
ftdi
,
OAU_VENDOR_ID
,
OAU_DEVICE_ID
))
<
0
)
{
ftdi_free
(
ctx
->
ftdi
);
return
ret
;
}
if
(
serial
)
{
ret
=
ftdi_usb_open_desc
(
ctx
->
ftdi
,
OAU_VENDOR_ID
,
OAU_DEVICE_ID
,
NULL
,
serial
);
if
(
ret
<
0
)
{
ftdi_free
(
ctx
->
ftdi
);
return
ret
;
}
}
else
{
/* open first, and maybe only, device at hand */
ret
=
ftdi_usb_open
(
ctx
->
ftdi
,
OAU_VENDOR_ID
,
OAU_DEVICE_ID
);
if
(
ret
<
0
)
{
ftdi_free
(
ctx
->
ftdi
);
return
ret
;
}
}
if
(
(
ret
=
ftdi_set_bitmode
(
ctx
->
ftdi
,
0xff
,
BITMODE_BITBANG
))
<
0
)
{
if
(
(
ret
=
ftdi_set_bitmode
(
ctx
->
ftdi
,
0xff
,
BITMODE_BITBANG
))
<
0
)
{
ftdi_usb_close
(
ctx
->
ftdi
);
ftdi_free
(
ctx
->
ftdi
);
return
ret
;
}
}
uint8_t
pins
;
...
...
software/lib/liboasis-usb-att.h
View file @
f9d1e06f
...
...
@@ -40,11 +40,11 @@ enum oau_att_value_enum {
* A board is selected by lun, and a handle is returned for further
* reference to it.
*
* @param
lun - LUN of msatt card
* @param
serial - serial number of USB attenuator
*
* @return >0 - on success, device file descriptor number
*/
int
oau_att_open
(
int
lun
);
int
oau_att_open
(
char
*
serial
);
/**
* @brief close a channel handle
...
...
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