diff --git a/userspace/README b/userspace/README index d95366f6..bc250df3 100644 --- a/userspace/README +++ b/userspace/README @@ -16,6 +16,8 @@ usb camera on asus eeepc 701 model one usb microphone (only work with user space usbipd daemon) one usb sound card (only work with user space usbipd daemon) one usb webcam (only work with user space usbipd daemon) +one usb TVBOX (it will display one or two screensoft and freeze, I don't know why, +perhaps because the iso transfer is not so iso...) To build userspace usbip tool: diff --git a/userspace/busenum.c b/userspace/busenum.c index cfee907e..f41166d1 100755 --- a/userspace/busenum.c +++ b/userspace/busenum.c @@ -465,7 +465,7 @@ int process_write_irp(PPDO_DEVICE_DATA pdodata, PIRP irp) ip_desc = (struct usbip_iso_packet_descriptor *) ((char *)(h+1) + in_len); for(i=0; iNumberOfPackets; i++){ - if(ip_desc->offset != urb->IsoPacket[i].Offset){ + if(ip_desc->offset > urb->IsoPacket[i].Offset){ KdPrint(("Warning, why offset changed?%d %d %d %d\n", i, ip_desc->offset, @@ -538,9 +538,6 @@ Bus_Write ( PCOMMON_DEVICE_DATA commonData; PPDO_DEVICE_DATA pdodata; - - KdPrint(("why\n")); - PAGED_CODE (); KdPrint(("enter Write func\n")); @@ -1372,12 +1369,22 @@ void show_pipe(unsigned int num, PUSBD_PIPE_INFORMATION pipe) pipe->PipeFlags)); } -void set_pipe(PUSBD_PIPE_INFORMATION pipe, PUSB_ENDPOINT_DESCRIPTOR ep_desc) +void set_pipe(PUSBD_PIPE_INFORMATION pipe, + PUSB_ENDPOINT_DESCRIPTOR ep_desc, + unsigned char speed) { + int mult; pipe->MaximumPacketSize = ep_desc->wMaxPacketSize; pipe->EndpointAddress = ep_desc->bEndpointAddress; pipe->Interval = ep_desc->bInterval; pipe->PipeType = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; + /* From usb_submit_urb in linux */ + if(pipe->PipeType==USB_ENDPOINT_TYPE_ISOCHRONOUS + &&speed==USB_SPEED_HIGH){ + mult = 1 + ((pipe->MaximumPacketSize >> 11) & 0x03); + pipe->MaximumPacketSize &= 0x7ff; + pipe->MaximumPacketSize *= mult; + } pipe->PipeHandle = make_pipe(ep_desc->bEndpointAddress, pipe->PipeType, ep_desc->bInterval); @@ -1449,7 +1456,7 @@ int post_select_interface(PPDO_DEVICE_DATA pdodata, KdPrint(("Warning, no ep desc\n")); return STATUS_INVALID_DEVICE_REQUEST; } - set_pipe(&intf->Pipes[i], ep_desc); + set_pipe(&intf->Pipes[i], ep_desc, pdodata->speed); show_pipe(i, &intf->Pipes[i]); } return STATUS_SUCCESS; @@ -1548,7 +1555,7 @@ int proc_select_config(PPDO_DEVICE_DATA pdodata, return STATUS_INVALID_DEVICE_REQUEST; } - set_pipe(&intf->Pipes[j], ep_desc); + set_pipe(&intf->Pipes[j], ep_desc, pdodata->speed); show_pipe(j, &intf->Pipes[j]); } intf=(char *)intf + sizeof(*intf) + (intf->NumberOfPipes - 1)* diff --git a/userspace/busenum.h b/userspace/busenum.h index e8c4232d..625a590a 100755 --- a/userspace/busenum.h +++ b/userspace/busenum.h @@ -94,6 +94,12 @@ Revision History: #define BUS_DBG_WMI_INFO 0x00040000 #define BUS_DBG_WMI_ERROR 0x00080000 +enum usb_device_speed { + USB_SPEED_UNKNOWN = 0, /* enumerating */ + USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ + USB_SPEED_HIGH, /* usb 2.0 */ + USB_SPEED_VARIABLE /* wireless (usb 2.5) */ +}; #if DBG #define BUS_DEFAULT_DEBUG_OUTPUT_LEVEL 0x000FFFFF diff --git a/userspace/buspdo.c b/userspace/buspdo.c index 73c1cbdc..5d1c3224 100755 --- a/userspace/buspdo.c +++ b/userspace/buspdo.c @@ -1158,13 +1158,6 @@ Return Value: return STATUS_SUCCESS; } -enum usb_device_speed { - USB_SPEED_UNKNOWN = 0, /* enumerating */ - USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ - USB_SPEED_HIGH, /* usb 2.0 */ - USB_SPEED_VARIABLE /* wireless (usb 2.5) */ -}; - BOOLEAN USB_BUSIFFN IsDeviceHighSpeed(PVOID context){ PPDO_DEVICE_DATA pdodata = context; KdPrint(("IsDeviceHighSpeed called, it is %d\n", pdodata->speed)); diff --git a/userspace/public.h b/userspace/public.h index fe81fd1e..5e7e8856 100755 --- a/userspace/public.h +++ b/userspace/public.h @@ -114,5 +114,4 @@ typedef struct _BUSENUM_EJECT_HARDWARE } BUSENUM_EJECT_HARDWARE, *PBUSENUM_EJECT_HARDWARE; - #endif diff --git a/userspace/usbip_vbus_ui.c b/userspace/usbip_vbus_ui.c index abf56eac..607f9e67 100644 --- a/userspace/usbip_vbus_ui.c +++ b/userspace/usbip_vbus_ui.c @@ -297,7 +297,7 @@ int check_out(unsigned long num) return 0; } -void fix_iso_desc_endian(char *buf, int num, int in_len) +void fix_iso_desc_endian(char *buf, int num) { struct usbip_iso_packet_descriptor * ip_desc; int i; @@ -311,8 +311,6 @@ void fix_iso_desc_endian(char *buf, int num, int in_len) all+=ip_desc->actual_length; ip_desc++; } - if(in_len!=all) - err("why it not equal %d %d\n", in_len, all); } #ifdef DEBUG @@ -386,7 +384,7 @@ int write_to_dev(char * buf, int buf_len, int len, SOCKET sockfd, } if(iso_len) fix_iso_desc_endian(sock_read_buf+sizeof(*u)+in_len, - u->u.ret_submit.number_of_packets, in_len); + u->u.ret_submit.number_of_packets); ret=WriteFile(devfd, buf, len, &out, ov); if(!ret||out!=len){ err("last error:%ld\n",GetLastError());