def _get_port_by_dev( dev ): """ """ usb_location = _get_usb_location( dev ) if usb_location: split_location = [int(x) for x in usb_location.split('.') if int(x) > 0] # only the last two digits are necessary return acroname.get_port_from_usb( split_location[-2], split_location[-1] )
def _get_port_by_dev( dev ): """ """ usb_location = _get_usb_location( dev ) split_port_location = usb_location.split( '.' ) first_port_coordinate = int( split_port_location[-2] ) second_port_coordinate = int( split_port_location[-1] ) port = acroname.get_port_from_usb( first_port_coordinate, second_port_coordinate ) return port
def _get_port_by_loc( usb_location ): """ """ if usb_location: split_port_location = usb_location.split( '.' ) first_port_coordinate = int( split_port_location[-2] ) second_port_coordinate = int( split_port_location[-1] ) port = acroname.get_port_from_usb( first_port_coordinate, second_port_coordinate ) return port
def _get_port_by_loc( usb_location ): """ """ if usb_location: # # T265 locations look differently... match = re.fullmatch( r'Port_#(\d+)\.Hub_#(\d+)', usb_location, re.IGNORECASE ) if match: # We don't know how to get the port from these yet! return None #int(match.group(2)) else: split_location = [int(x) for x in usb_location.split('.')] # only the last two digits are necessary return acroname.get_port_from_usb( split_location[-5], split_location[-4] )