53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
#include "DRI/Dri_Consumer.h"
|
|
|
|
void Dri_Consumer_Close(Dri_Consumer_Struct_Port* p_Port)
|
|
{
|
|
Dri_Hid_CloseReadPort(&p_Port->ReadPort);
|
|
}
|
|
|
|
bool Dri_Consumer_Init(
|
|
Dri_Consumer_Struct_Port* p_Port,
|
|
const Mid_Struct_DeviceConfig& DeviceConfig,
|
|
QString* p_TextStatus)
|
|
{
|
|
Dri_Consumer_Close(p_Port);
|
|
|
|
Mid_Struct_DeviceMatch Match;
|
|
Match.VendorId = DeviceConfig.VendorId;
|
|
Match.ProductId = DeviceConfig.ProductId;
|
|
Match.UsagePage = MID_CONST_USAGE_PAGE_CONSUMER;
|
|
Match.Usage = MID_CONST_USAGE_CONSUMER;
|
|
|
|
QString DevicePath;
|
|
quint16 InputLength = 0;
|
|
if (!Mid_FindHidInterface(
|
|
Match,
|
|
&DevicePath,
|
|
&InputLength,
|
|
nullptr))
|
|
{
|
|
if (p_TextStatus != nullptr)
|
|
{
|
|
*p_TextStatus = QStringLiteral("Consumer interface was not found: 000C / 0001.");
|
|
}
|
|
return false;
|
|
}
|
|
|
|
return Dri_Hid_InitReadPort(
|
|
&p_Port->ReadPort,
|
|
DevicePath,
|
|
InputLength,
|
|
Mid_Enum_RawPacketSource_UsbConsumerHid,
|
|
QStringLiteral("Consumer"),
|
|
p_TextStatus);
|
|
}
|
|
|
|
bool Dri_Consumer_Read(
|
|
Dri_Consumer_Struct_Port* p_Port,
|
|
Mid_Struct_RawPacket* p_Packet,
|
|
QString* p_TextStatus)
|
|
{
|
|
return Dri_Hid_Read(&p_Port->ReadPort, p_Packet, p_TextStatus);
|
|
}
|
|
|