def get_data(self, reset_device=False):
try:<EOL><INDENT>if reset_device:<EOL><INDENT>self._device.reset()<EOL><DEDENT>for interface in [<NUM_LIT:0>,<NUM_LIT:1>]:<EOL><INDENT>if self._device.is_kernel_driver_active(interface):<EOL><INDENT>LOGGER.debug('<STR_LIT>'<EOL>'<STR_LIT>', interface, self._device, self._ports)<EOL>self._device.detach_kernel_driver(interface)<EOL><DEDENT><DEDENT>self._device.set_configuration()<EOL>usb.util.claim_interface(self._device, INTERFACE)<EOL>self._control_transfer(COMMANDS['<STR_LIT>'])<EOL>self._interrupt_read()<EOL>self._control_transfer(COMMANDS['<STR_LIT>'])<EOL>temp_data = self._interrupt_read()<EOL>if self._device.product == '<STR_LIT>':<EOL><INDENT>humidity_data = temp_data<EOL><DEDENT>else:<EOL><INDENT>humidity_data = None<EOL><DEDENT>data = {'<STR_LIT>': temp_data, '<STR_LIT>': humidity_data}<EOL>usb.util.dispose_resources(self._device)<EOL>return data<EOL><DEDENT>except usb.USBError as err:<EOL><INDENT>if not reset_device:<EOL><INDENT>LOGGER.warning("<STR_LIT>", err, self._device)<EOL>return self.get_data(True)<EOL><DEDENT>if "<STR_LIT>" in str(err):<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>LOGGER.error(err)<EOL>raise<EOL><DEDENT><DEDENT>
Get data from the USB device.