def read(self, length): data, address = self.socket.recvfrom(length) logger.log_raw( f"{self.bind_ip}:{self.bind_port} < {address[0]}:{address[1]}", data.hex(), ) return data
def read(self, length): data, address = self.socket.recvfrom(length) logger.log_raw( "{}:{} < {}:{}".format(self.bind_ip, self.bind_port, address[0], address[1]), data.hex(), ) return data
def write(self, data): bytes_sent = self.socket.sendto( data, ((self.destination_ip, self.destination_port))) assert bytes_sent == len(data) logger.log_raw( f"{self.destination_ip}:{self.destination_port} < {self.bind_ip}:{self.bind_port}", data.hex(), )
def write(self, data): bytes_sent = self.socket.sendto( data, ((self.destination_ip, self.destination_port))) assert bytes_sent == len(data) logger.log_raw( "{}:{} < {}:{}".format(self.destination_ip, self.destination_port, self.bind_ip, self.bind_port), data.hex(), )
def __uhid_write(self, data): bytes_written = os.write(self.file_descriptor, data) assert bytes_written == len(data) logger.log_raw("{} <".format(HIDInterface.uhid_device), data.hex())
def __uhid_read(self, length): data = os.read(self.file_descriptor, length) logger.log_raw("{} >".format(HIDInterface.uhid_device), data.hex()) return data
def __uhid_read(self, length): data = os.read(self.file_descriptor, length) logger.log_raw(f"{HIDInterface.uhid_device} >", data.hex()) return data