hw/usb/canokey: Fix CCID ZLP
CCID could send zero-length packet (ZLP) if we invoke two data_in, two packets would be concated and we could not distinguish them. The CANOKEY_EMU_EP_CTAPHID is imported from canokey-qemu.h Reported-by: MkfsSion <myychina28759@gmail.com> Signed-off-by: Hongren (Zenithal) Zheng <i@zenithal.me> Message-Id: <YqcqGz0s3+LE42ms@Sun> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
		
							parent
							
								
									8c0d80245f
								
							
						
					
					
						commit
						ada270cd18
					
				@ -109,11 +109,10 @@ int canokey_emu_transmit(
 | 
				
			|||||||
     * Note: this is a quirk for CanoKey CTAPHID
 | 
					     * Note: this is a quirk for CanoKey CTAPHID
 | 
				
			||||||
     * because it calls multiple emu_transmit in one device_loop
 | 
					     * because it calls multiple emu_transmit in one device_loop
 | 
				
			||||||
     * but w/o data_in it would stuck in device_loop
 | 
					     * but w/o data_in it would stuck in device_loop
 | 
				
			||||||
     * This has no side effect for CCID as it is strictly
 | 
					     * This has side effect for CCID since CCID can send ZLP
 | 
				
			||||||
     * OUT then IN transfer
 | 
					     * This also has side effect for Control transfer
 | 
				
			||||||
     * However it has side effect for Control transfer
 | 
					 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    if (ep_in != 0) {
 | 
					    if (ep_in == CANOKEY_EMU_EP_CTAPHID) {
 | 
				
			||||||
        canokey_emu_data_in(ep_in);
 | 
					        canokey_emu_data_in(ep_in);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user