Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# SPDX-License-Identifier: MIT
from ratbag_emu.device import Device # pragma: no cover
''' Represents a device endpoint
A HID device is created for each endpoint. The enpoint can be used to receive and send data
:param owner: Endpoint owner :param rdesc: Report descriptor :param number: Endpoint number '''
f'{self.vid:04x}:{self.pid:04x}, {self.number})'
''' Receive data
Callback called when we receive a HID report. Triggers the firmware's callback.
:param data: Received data :param size: Received data size :param rtype: Report type ''' data = [struct.unpack('>H', b'\x00' + data[i:i + 1])[0] # type: ignore for i in range(0, size)]
if size > 0: self.logger.debug('read {}'.format(' '.join(f' {byte:02x}' for byte in data)))
self._owner.fw.hid_receive(data, size, rtype, self.number)
''' Send data
Routine used to send a HID report.
:param data: Data to send ''' return
for byte in data)))
skip_empty: bool = True): ''' Converts action into HID report
Converts action in HID report according to the report descriptor and sends it.
:param action: Object holding the desired actions as attributes :param global_data: ? :param skip_empty: Enables skipping empty actions '''
return
#self.__logger.debug('generating report for {}'.format( # ', '.join(f'{name} = {val}' # for name, val in action.__dict__.items())))
|