Skip to content

Commit

Permalink
fix for my tvbox
Browse files Browse the repository at this point in the history
  • Loading branch information
lepton-wu committed Jul 8, 2009
1 parent 5b0425c commit fb955e8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
2 changes: 2 additions & 0 deletions userspace/README
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
21 changes: 14 additions & 7 deletions userspace/busenum.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; i<urb->NumberOfPackets; 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,
Expand Down Expand Up @@ -538,9 +538,6 @@ Bus_Write (
PCOMMON_DEVICE_DATA commonData;
PPDO_DEVICE_DATA pdodata;


KdPrint(("why\n"));

PAGED_CODE ();

KdPrint(("enter Write func\n"));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)*
Expand Down
6 changes: 6 additions & 0 deletions userspace/busenum.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions userspace/buspdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
1 change: 0 additions & 1 deletion userspace/public.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,4 @@ typedef struct _BUSENUM_EJECT_HARDWARE

} BUSENUM_EJECT_HARDWARE, *PBUSENUM_EJECT_HARDWARE;


#endif
6 changes: 2 additions & 4 deletions userspace/usbip_vbus_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit fb955e8

Please sign in to comment.