下面這個(gè)是 修改了hidmouseservice.c文件中uint8_t hidReportMap[]的報(bào)表
//?HID?Report?Map?characteristic?value static?const?uint8_t?hidReportMap[]?=?{ ????????0x05,?0x01,?//?USAGE_PAGE?(Generic?Desktop)?用途頁(yè)-桌面通用 ????????0x09,?0x02,?//?USAGE?(Mouse)用途-鼠標(biāo) ????????0xa1,?0x01,?//?COLLECTION?(Application)開(kāi)集合-應(yīng)用 ????????0x85,?0x02,?//Report?ID?(178) ????????0x09,?0x01,?//???USAGE?(Pointer)用途-指針 ????????0xa1,?0x00,?//???COLLECTION?(Physical)開(kāi)集合-物理 ????????0x05,?0x09,?//?????USAGE_PAGE?(Button)用途頁(yè)-按鍵 ????????0x19,?0x01,?//?????USAGE_MINIMUM?(Button?1)用途最小值-鼠標(biāo)左鍵 ????????0x29,?0x03,?//?????USAGE_MAXIMUM?(Button?3)用途最大值-鼠標(biāo)中鍵 ????????0x15,?0x00,?//?????LOGICAL_MINIMUM?(0)邏輯最小值-0:按鍵抬起 ????????0x25,?0x01,?//?????LOGICAL_MAXIMUM?(1)邏輯最大值-1:按鍵按下 ????????0x95,?0x03,?//?????REPORT_COUNT?(3)報(bào)告數(shù)量-3:3個(gè)按鍵 ????????0x75,?0x01,?//?????REPORT_SIZE?(1)報(bào)告小組-1:1組 ????????0x81,?0x02,?//?????INPUT?(Data,Var,Abs)數(shù)據(jù)輸入:可變,獨(dú)立,絕對(duì)值 ????????0x95,?0x01,//報(bào)告數(shù)量:1 ????????0x75,?0x05,//報(bào)告小組:5,為了和前面的3bit湊成一個(gè)字節(jié) ????????0x81,?0x03,//數(shù)據(jù)輸入:常量,獨(dú)立,絕對(duì)值 ????????0x05,?0x01,?//?????USAGE_PAGE?(Generic?Desktop)用途頁(yè)-桌面通用 ????????0x09,?0x30,?//?????USAGE?(X)用途:X軸 ????????0x09,?0x31,?//?????USAGE?(Y)用途:Y軸 ????????0x15,?0x00,?//?????LOGICAL_MINIMUM?(0)邏輯最小值:0 ????????0x26,?0xff,?0x7f,?//?????LOGICAL_MAXIMUM?(32767)邏輯最大值:32767,表示鼠標(biāo)的左右、上下移動(dòng) ????????0x75,?0x10,?//?????REPORT_SIZE?(16)報(bào)告數(shù)量:16?位 ????????0x95,?0x02,?//?????REPORT_COUNT?(2)報(bào)告小組:2,X一個(gè),Y一個(gè),剛好兩個(gè) ????????0x81,?0x02,?//?????INPUT?(Data,Var,Rel)數(shù)據(jù)輸入:可變、獨(dú)立、相對(duì)值 ????????0xc0,???????//?????END_COLLECTION ????????0xc0????????//?END_COLLECTION };
這個(gè)報(bào)表描述符由6字節(jié)組成,
BIT0:報(bào)表描述符的ID,固定位為0x02.
BIT1:bit0-bit2分別指示了鼠標(biāo)左右中鍵的是否按下,其位高5位固定值為0。
BIT2-BIT3:代表當(dāng)前指針的X坐標(biāo),取值范圍為0-32767
BIT4-BIT5:代表當(dāng)前指針的Y坐標(biāo),取值范圍為0-32767
同時(shí)修改了
static?void?hidEmuSendMouseReport(uint8_t?buttons,?uint16_t?X_data,?uint16_t?Y_data) { ????uint8_t?buf[HID_MOUSE_IN_RPT_LEN]; ????buf[0]?=?0x02;?//?Buttons ????buf[1]?=?buttons;?//BIT0-BIT2分別指示了鼠標(biāo)左右中鍵的是否按下,其位高5位固定值為0。 ????buf[2]?=?(uint8_t)X_data;????????//?X?axis?data?low?8bit ????buf[3]?=?(uint8_t)(X_data?>>?8);?//?X?axis?data?high?8bit ????buf[4]?=?(uint8_t)Y_data;????????//?Y?axis?data?low?8bit ????buf[5]?=?(uint8_t)(Y_data?>>?8);?//?Y?axis?data?high?8bit ????HidDev_Report(HID_RPT_ID_MOUSE_IN,?HID_REPORT_TYPE_INPUT, ??????????????????HID_MOUSE_IN_RPT_LEN,?buf); }
在電腦上面是 可以實(shí)現(xiàn) 573f 輸出絕對(duì)坐標(biāo)的,
使用hidEmuSendMouseReport(0, 200, 200); 可以實(shí)現(xiàn)鼠標(biāo)指針的 指定坐標(biāo)跳轉(zhuǎn),而在手機(jī)上就沒(méi)有反應(yīng)了,
這是為什么呢,需要怎么修改