Skip to content

Commit

Permalink
Move the csg additions to above the main method, cannot forward decla…
Browse files Browse the repository at this point in the history
…re the methods
  • Loading branch information
wahajsyed authored and doublemis1 committed Jul 7, 2021
1 parent ba2ba14 commit 4c49ca9
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions src/controller/python/chip-device-ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,8 @@ def __check_supported_os()-> bool:

def main():
start_rpc_server()

# Never Executed: does not return here
# Never reach here
optParser = OptionParser()
optParser.add_option(
"-r",
Expand Down Expand Up @@ -934,15 +934,9 @@ def main():
dest="bluetoothAdapter",
default="hci0",
type="str",
help="Controller bluetooth adapter ID, use --no-ble to disable bluetooth functions.",
help="Controller bluetooth adapter ID",
metavar="<bluetooth-adapter>",
)
optParser.add_option(
"--no-ble",
action="store_true",
dest="disableBluetooth",
help="Disable bluetooth, calling BLE related feature with this flag results in undefined behavior.",
)
(options, remainingArgs) = optParser.parse_args(sys.argv[1:])

if len(remainingArgs) != 0:
Expand All @@ -951,9 +945,7 @@ def main():

adapterId = None
if sys.platform.startswith("linux"):
if options.disableBluetooth:
adapterId = None
elif not options.bluetoothAdapter.startswith("hci"):
if not options.bluetoothAdapter.startswith("hci"):
print(
"Invalid bluetooth adapter: {}, adapter name looks like hci0, hci1 etc.")
sys.exit(-1)
Expand All @@ -965,14 +957,8 @@ def main():
"Invalid bluetooth adapter: {}, adapter name looks like hci0, hci1 etc.")
sys.exit(-1)

try:
devMgrCmd = DeviceMgrCmd(rendezvousAddr=options.rendezvousAddr,
controllerNodeId=options.controllerNodeId, bluetoothAdapter=adapterId)
except Exception as ex:
print(ex)
print("Failed to bringup CHIPDeviceController CLI")
sys.exit(1)

devMgrCmd = DeviceMgrCmd(rendezvousAddr=options.rendezvousAddr,
controllerNodeId=options.controllerNodeId, bluetoothAdapter=adapterId)
print("Chip Device Controller Shell")
if options.rendezvousAddr:
print("Rendezvous address set to %s" % options.rendezvousAddr)
Expand Down

0 comments on commit 4c49ca9

Please sign in to comment.