/******************************************************************************** * Copyright (c) 2016, Beijing Tongfang Microelectroics Co., Ltd. * All rights reserved. * Module: HID class response * Author: Yang Song * Version: V1.0 * History: * 2016-09-22 Original version ********************************************************************************/ #include "global.h" u8 g_bCapsLock=CAPSLOCKOFF; //0: 没开; 1:开了 u8 g_bNumLock=NUMLOCKOFF; //0: 没开; 1:开了 /*************************************************************************** * Function: hidSendReportDscrpt * Description:HID Data processing * Input: NULL * Return: NULL * Other: NULL **************************************************************************/ void hidSendReportDscrpt(void) { if(g_bUsbDevType == USBDEVTYPE_HIDPOS) { Memcpy(USBbuf,(u8 *)usbHidPosReportDescriptor,HID_POS_RPT_LEN); usbEpnTxAll(0,USBbuf,HID_POS_RPT_LEN); } else if(g_bUsbDevType == USBDEVTYPE_HIDKBD) { Memcpy(USBbuf,(u8 *)usbHidKbdReportDescriptor,HID_KBD_RPT_LEN); usbEpnTxAll(0,USBbuf,HID_KBD_RPT_LEN); } } /*************************************************************************** * Function: Hid_SendReportDscrpt * Description:HID Data processing * Input: NULL * Return: NULL * Other: NULL **************************************************************************/ void hidReportRequest(u8 req) { switch(req) { case SET_REPORT : hidSetReportRequest(); break; case GET_REPORT : hidGetReportRequest(); break; default : break; } } /*************************************************************************** * Function: Hid_SendReportDscrpt * Description:HID Data processing * Input: NULL * Return: NULL * Other: NULL **************************************************************************/ void hidGetReportRequest(void) { } /*************************************************************************** * Function: fSet_Report * Description:HID Data processing * Input: NULL * Return: NULL * Other: NULL **************************************************************************/ void hidSetReportRequest(void) { if(g_bUsbDevType == USBDEVTYPE_HIDKBD) { if((st_usbDeviceRequest.wValue & 0xFFFF) == 0x200) { while(!EP0STSCXDPKT); if(g_abUsbEp0Buf[0] & 0x02) //大写 { g_bCapsLock = CAPSLOCKON; } else //小写 { g_bCapsLock = CAPSLOCKOFF; } if(g_abUsbEp0Buf[0] & 0x01) //numlock { g_bNumLock = NUMLOCKON; } else { g_bNumLock = NUMLOCKOFF; } return; } } } //发送小键盘锁定 void SendNumLock(void) { memset(g_abUsbEp2Buf,0,8); g_abUsbEp2Buf[2] = 0x53; usbEpnTxAll(2,g_abUsbEp2Buf,8); g_abUsbEp2Buf[2] = 0x00; usbEpnTxAll(2,g_abUsbEp2Buf,8); }