This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM8148 USB兼容性问题

Hi:

   我们正在使用DM8148的主控,在使用它的USB Host时,发现兼容性问题。

   我们开发了一个简单的Demo程序,即通过SCSI协议向USB Storage设备发Inquery操作,核心代码如下:

int execute_Inquiry(int fd, int page_code, int evpd, struct sg_io_hdr * p_hdr) {
	unsigned char cdb[6];
	/* set the cdb format */
	cdb[0] = 0x12; /*This is for Inquery*/
	cdb[1] = evpd & 1;
	cdb[2] = page_code & 0xff;
	cdb[3] = 0;
	cdb[4] = 0xff;
	cdb[5] = 0; /*For control filed, just use 0*/
 
	p_hdr->dxfer_direction = SG_DXFER_FROM_DEV;
	p_hdr->cmdp = cdb;
	p_hdr->cmd_len = 6;
 
	int ret = ioctl(fd, SG_IO, p_hdr);

	if (ret<0) {
		printf("Sending SCSI Command failed.\n");
		close(fd);
		exit(1);
	}
	return p_hdr->status;
}

    一般的U盘上此Demo都能正常工作,但在某些U盘测试此Demo时,ioctl总是阻塞,大约1分钟后才能返回正确值,这种情况下内核有如下报错:

[23547.779000] usb 1-1: sg_complete, unlink --> -43

[23547.779000] musb-hdrc musb-hdrc.0: dev 1 ep1in scatterlist error -121/-121

[23608.064000] musb-hdrc musb-hdrc.0: Data toggle same as previous (=1) on ep2

[23608.166000] usb 1-1: reset high speed USB device using musb-hdrc and address 6

     请问这个有什么好的解决办法吗?万分感激。