We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
你好,我参照你的代码实现CH341的模拟,目前已经成功枚举,串口调试软件也能成功打开串口,但打开串口之后电脑不断请求设备状态,也就是下面:
int ch341_get_status(struct usb_device *dev) { char *buffer; int r = -ENOMEM; const unsigned size = 8; dbg("ch341_get_status()"); buffer = kmalloc(size, GFP_KERNEL); if (!buffer) goto out; r = ch341_control_in(dev, 0x95, 0x0706, 0, buffer, size); /* return value ignored */ r = 0; out: kfree(buffer); return r; }
我猜测是上位机让设备复位后在查询设备的复位情况。你的代码里面的处理方式是:
/******************************************************************************* * Function Name : Virtual_Com_Port_Data_Setup * Description : handle the data class specific requests * Input : Request Nb. * Output : None. * Return : USB_UNSUPPORT or USB_SUCCESS. *******************************************************************************/ static u8 vender_request; u8 *Vender_Handle_CH341(u16 Length) { u16 wValue = pInformation->USBwValues.w; u16 wIndex = pInformation->USBwIndexs.w; static u8 buf1[2]={0x30,0}; static u8 buf2[2]={0xc3,0}; change_byte(wValue); change_byte(wIndex); // 省略其他代码... case 0x95: if(wValue==0x2518) return buf2; else if(wValue==0x0706) return (u8 *)&ch341_state; } return 0; }
我按照你的代码返回值为0xee9f的ch341_state返回,但并没有解决问题。
0xee9f
ch341_state
希望能从你这获得帮助,谢谢!
The text was updated successfully, but these errors were encountered:
改行啦 不玩硬件啦
Sorry, something went wrong.
No branches or pull requests
你好,我参照你的代码实现CH341的模拟,目前已经成功枚举,串口调试软件也能成功打开串口,但打开串口之后电脑不断请求设备状态,也就是下面:
我猜测是上位机让设备复位后在查询设备的复位情况。你的代码里面的处理方式是:
我按照你的代码返回值为
0xee9f
的ch341_state
返回,但并没有解决问题。希望能从你这获得帮助,谢谢!
The text was updated successfully, but these errors were encountered: