本人用的是KIT2416的开发板,内核是linux2.6.21版本。现在usb device 驱动有以下几个问题:
启动以后出现:
hub 1-0:1.0: cannot enable port2. Maybe the USB cable is bad?
hub 1-0:1.0: cannot enable port2. Maybe the USB cable is bad?
hub 1-0:1.0: cannot enable port2. Maybe the USB cable is bad?
hub 1-0:1.0: cannot enable port2. Maybe the USB cable is bad?
基本能使用,但是偶尔会在传输过程中出错,然后卡死,初步判读时USB没有复位引起的,不知道怎么处理。
哪位大侠有遇到过这个问题,求解。
------解决方案--------------------
复位用的不对
- C/C++ code
/* return: -1 on error, 0 on success, 1 on disconnect. */ static int usb_hub_port_reset(struct usb_device *hub, int port, struct usb_device *dev, unsigned int delay) { int i, status; /* Reset the port */ for (i = 0; i < HUB_RESET_TRIES; i++) { usb_set_port_feature(hub, port + 1, USB_PORT_FEAT_RESET); /* return on disconnect or reset */ status = usb_hub_port_wait_reset(hub, port, dev, delay); if (status != -1) { usb_clear_port_feature(hub, port + 1, USB_PORT_FEAT_C_RESET); return status; } dbg("port %d of hub %d not enabled, trying reset again...", port + 1, hub->devnum); delay = HUB_LONG_RESET_TIME; } err("Cannot enable port %i of hub %d, disabling port.", port + 1, hub->devnum); err("Maybe the USB cable is bad?"); return -1; }