当手机处于人像方向(1080x1920)时,一切都工作正常,当更改为横向(1920x1080)时,坐标旋转90度,沿X轴(现在为1920)的移动限制为1080.
手动切换X&通过HID报告发送的Y坐标使光标与设备的物理移动对齐,然而水平轴(现在为1920)仍然限制为1080.
在HID描述符上,使LOGICAL_MAXIMUM大于PHYSICAL_MAXIMUM没有任何影响......
总而言之,是否可以支持Digitizer设备的方向更改?我应该以任何方式更改描述符以使方向更改正常工作吗?
enum :BYTE { REPORT_ID = 4 };
const UCHAR DESCRIPTOR[] = {
0x05, 0x0d, // USAGE_PAGE (Digitizers)
0x09, 0x04, // USAGE (Touch Screen)
0xa1, 0x01, // COLLECTION (Application)
0x85, REPORT_ID, // REPORT_ID (4)
0x09, 0x20, // USAGE (Stylus)
0xa1, 0x00, // COLLECTION (Physical)
0x09, 0x42, // USAGE (Tip Switch)
0x09, 0x32, // USAGE (In Range)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x02, // REPORT_COUNT (2)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x06, // REPORT_COUNT (6)
0x81, 0x01, // INPUT (Cnst,Ary,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x46, 0x10, 0x27, // PHYSICAL_MAXIMUM (10000)
0x26, 0x10, 0x27, // LOGICAL_MAXIMUM (10000)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x55, 0x0F, // UNIT_EXPONENT (-1)
0x65, 0x11, // UNIT (cm,SI Linear)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x45, 0x00, // PHYSICAL_MAXIMUM (0)
0x09, 0x30, // USAGE (X)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x31, // USAGE (Y)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0xc0, // END_COLLECTION
};
struct Report {
enum :LONG { RES_X = 10000, RES_Y = 10000 };
UCHAR report_id; // Must be set to 4
struct {
UCHAR bTipSwitch : 1;
UCHAR bInRange : 1;
UCHAR reserved : 6;
} status;
USHORT wXData;
USHORT wYData;
inline static void NormalizeCoordinates(IN const SIZE& res, IN OUT USHORT& x, IN OUT USHORT& y) {
if ((0 == res.cx) || (0 == res.cy)) {
assert(FALSE);
return;
}
x = (USHORT)((RES_X * x) / res.cx);
y = (USHORT)((RES_Y * y) / res.cy);
}
};