Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michael Black
OpenXG-RAN
Commits
1b6407d7
Commit
1b6407d7
authored
Jan 12, 2016
by
Rohit Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes to reset USB bus for bandrich UE
parent
c2e58bcf
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
29 deletions
+101
-29
cmake_targets/autotests/test_case_list.xml
cmake_targets/autotests/test_case_list.xml
+27
-27
cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
+54
-2
cmake_targets/autotests/tools/find_usb_path.bash
cmake_targets/autotests/tools/find_usb_path.bash
+20
-0
No files found.
cmake_targets/autotests/test_case_list.xml
View file @
1b6407d7
This diff is collapsed.
Click to expand it.
cmake_targets/autotests/tools/configure_cots_bandrich_ue.py
View file @
1b6407d7
...
...
@@ -10,6 +10,7 @@ import threading
import
signal
import
traceback
import
os
import
commands
# configure the serial connections (the parameters differs on the device you are connecting to)
#First we find an open port to work with
...
...
@@ -34,8 +35,7 @@ def find_open_port():
ser
=
serial
.
Serial
(
port
=
serial_port
)
return
find_open_port
()
print
'Using Serial port : '
+
serial_port
#serial_port = '/dev/ttyUSB2'
bandrich_ppd_config
=
os
.
environ
.
get
(
'OPENAIR_DIR'
)
+
'/cmake_targets/autotests/tools/wdial.bandrich.conf'
...
...
@@ -144,11 +144,63 @@ def stop_ue():
send_command
(
'AT+CGATT=0'
,
'OK|ERROR'
,
timeout
)
send_command
(
'AT+CFUN=4'
,
'OK'
,
timeout
)
#reset the USB BUS of Bandrich UE
def
reset_ue
():
stringIdBandrich
=
'BandRich, Inc. 4G LTE adapter'
status
,
out
=
commands
.
getstatusoutput
(
'lsusb | grep -i
\'
'
+
stringIdBandrich
+
'
\'
'
)
if
(
out
==
''
)
:
print
"Bandrich 4G LTE Adapter not found. Exiting now..."
sys
.
exit
()
p
=
re
.
compile
(
'Bus\s*(\w+)\s*Device\s*(\w+):\s*ID\s*(\w+):(\w+)'
)
res
=
p
.
findall
(
out
)
BusId
=
res
[
0
][
0
]
DeviceId
=
res
[
0
][
1
]
VendorId
=
res
[
0
][
2
]
ProductId
=
res
[
0
][
3
]
usb_dir
=
find_usb_path
(
VendorId
,
ProductId
)
print
usb_dir
cmd
=
"sudo sh -c
\"
echo 0 > "
+
usb_dir
+
"/authorized
\"
"
os
.
system
(
cmd
+
" ; sleep 5"
)
cmd
=
"sudo sh -c
\"
echo 1 > "
+
usb_dir
+
"/authorized
\"
"
os
.
system
(
cmd
+
" ; sleep 5"
)
def
read_file
(
filename
):
try
:
file
=
open
(
filename
,
'r'
)
return
file
.
read
()
except
Exception
,
e
:
#error = ' Filename ' + filename
#error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
#error = error + traceback.format_exc()
#print error
return
''
def
find_usb_path
(
idVendor
,
idProduct
):
for
root
,
dirs
,
files
in
os
.
walk
(
"/sys/bus/usb/devices"
,
topdown
=
False
):
for
name
in
dirs
:
tmpdir
=
os
.
path
.
join
(
root
,
name
)
tmpidVendor
=
read_file
(
tmpdir
+
'/idVendor'
).
replace
(
"
\n
"
,
""
)
tmpidProduct
=
read_file
(
tmpdir
+
'/idProduct'
).
replace
(
"
\n
"
,
""
)
#print "tmpdir = " + tmpdir + " tmpidVendor = " + tmpidVendor + " tmpidProduct = " + tmpidProduct
if
tmpidVendor
==
idVendor
and
tmpidProduct
==
idProduct
:
return
tmpdir
return
''
for
arg
in
sys
.
argv
[
1
:]:
if
arg
==
'--start-ue'
:
find_open_port
()
print
'Using Serial port : '
+
serial_port
start_ue
()
elif
arg
==
'--stop-ue'
:
find_open_port
()
print
'Using Serial port : '
+
serial_port
stop_ue
()
elif
arg
==
'--reset-ue'
:
reset_ue
()
else
:
print
" Script called with wrong arguments, arg = "
+
arg
sys
.
exit
()
cmake_targets/autotests/tools/find_usb_path.bash
0 → 100755
View file @
1b6407d7
#!/bin/bash
#arg1 idVendor
#arg2 idProduct
argIdVendor
=
$1
argIdProduct
=
$2
echo
$1
echo
$2
for
X
in
/sys/bus/usb/devices/
*
;
do
#echo "$X"
idVendor
=
`
cat
"
$X
/idVendor"
2>/dev/null
`
idProduct
=
`
cat
"
$X
/idProduct"
2>/dev/null
`
if
[
"
$argIdVendor
"
==
"
$idVendor
"
]
&&
[
"
$argIdProduct
"
==
"
$idProduct
"
]
then
echo
"
$X
"
fi
done
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