hi
i am implementing a USB audio client driver in XP.
there is a inconsistency problem for my set interface function.
if i check it for continue three or four time it works but after that its not work.
in my set interface function i am doing this
MySetInterface(IN PKSDEVICE m_Device,UINT8 interface_no,UINT8 alt_setting)
{
PURB urb;
NTSTATUS status=STATUS_SUCCESS;
RtlZeroMemory(&urb,sizeof(struct _URB));
UsbBuildSelectInterfaceRequest(&urb, (USHORT)GET_SELECT_INTERFACE_REQUEST_SIZE(1),
config_handle,
interface_no,
alt_setting);
urb.UrbSelectInterface.Interface.Length = GET_USBD_INTERFACE_SIZE(1);
urb.UrbSelectInterface.Interface.Pipes[0].MaximumTransferSize = USBD_DEFAULT_MAXIMUM_TRANSFER_SIZE;
status = SendUrb(m_Device, &urb)
if (!NT_SUCCESS(status))
{
KdPrint((“SetInterface:Failed to fetch config \n”));
}
pipe_handle2=urb.UrbSelectInterface.Interface.Pipes[0].PipeHandle;
ULONG pt = urb.UrbSelectInterface.Interface.Pipes[0].PipeType;
return status;
}
and in my sendUrb function
SendUrb (
IN PKSDEVICE mdevice,
IN PURB urb,
)
{
PAGED_CODE();
PURB urb;
ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);
KEVENT event;
KeInitializeEvent(&event,
NotificationEvent,
FALSE);
IO_STATUS_BLOCK iostatus;
PIRP Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_SUBMIT_URB,
mdevice->NextDeviceObject ,
NULL,
0,
NULL,
0,
TRUE,
&event,
&iostatus);
if (!Irp)
{
KdPrint(( " - Unable to allocate IRP for sending URB\n"));
return STATUS_INSUFFICIENT_RESOURCES;
}
PIO_STACK_LOCATION stack = IoGetNextIrpStackLocation(Irp);
stack->Parameters.Others.Argument1 = (PVOID) urb;
NTSTATUS status = IoCallDriver(mdevice->NextDeviceObject,
Irp);
if (status == STATUS_PENDING)
{
KeWaitForSingleObject(&event,
Executive,
KernelMode,
FALSE,
NULL);
status = iostatus.Status;
}
return status;
}
the problem is that when its call sendurb.
in sendurb i call IoCallDriver(mdevice->NextDeviceObject,
Irp);
some times its not goes further.
can anyone knows why its like that??