Welcome to WinForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Regarding status_unsuccessful+IoCalldriver+UsbBuildVendorR..

 
   Windows XP (Home) -> XP Device Driver RSS
Next:  Need help with xp MCE, unable to record movies, H..  
Author Message
zyx

External


Since: Dec 13, 2006
Posts: 14



(Msg. 1) Posted: Sun Jan 14, 2007 10:19 pm
Post subject: Regarding status_unsuccessful+IoCalldriver+UsbBuildVendorRequest
Archived from groups: microsoft>public>windowsxp>device_driver>dev (more info?)

Hi,
I am working on adding support of DFU to the exixting usb function
driver.My driver goes to DFU mode now.
If I give a getstatus request to the device.It is giving me
status_unsuccessful.
After it calls the IoCallDriver it returns c0000001 error code.
I am not sure why it is coming.I am executing the same piece of code 2
times.one before resetting the device.ie once the device exposes its
normal descriptor I gave detach request to it.The same piece of code is
executed again after the device changes its mode(ie, to DFU).and now it
gives me status_unsuccessful.
The piece of code that I am executing is given below
NTSTATUS SendDFUCommand(PDEVICE_OBJECT fdo,USHORT direction,UCHAR
request,
USHORT value,USHORT index,PVOID data,ULONG *length)
{
PAGED_CODE();
NTSTATUS status;
PURB urb;
PIRP irp;
KEVENT event;
IO_STATUS_BLOCK iostatus;

/* TODO: Remove after testing */
KdPrint((DRIVERNAME " - Inside SendDFUCommand\n"));

PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
urb = (PURB) ExAllocatePool(NonPagedPool,sizeof(struct
_URB_CONTROL_VENDOR_OR_CLASS_REQUEST));
UsbBuildVendorRequest(
urb,
URB_FUNCTION_CLASS_INTERFACE,
sizeof(struct _URB_CONTROL_VENDOR_OR_CLASS_REQUEST),
direction?USBD_TRANSFER_DIRECTION_IN : USBD_TRANSFER_DIRECTION_OUT,
0,request,
value,index,
data,NULL,*length,
0
);
KdPrint((DRIVERNAME " - DFU_Request %X \n", request));
KdPrint((DRIVERNAME " - Timeout milliseconds %X \n", value));
KdPrint((DRIVERNAME " - DFU Interface %X \n", index));
KdPrint((DRIVERNAME " - Data send or received %X \n", data));
KdPrint((DRIVERNAME " - Total length of data %X \n", *length));

KeInitializeEvent(&event, NotificationEvent, FALSE);
KdPrint((DRIVERNAME " - iostatus %X \n", &iostatus));
irp = IoBuildDeviceIoControlRequest(
IOCTL_INTERNAL_USB_SUBMIT_URB,
pdx->LowerDeviceObject,
NULL, 0, NULL, 0, TRUE, &event, &iostatus);
if (!irp)
{
KdPrint((DRIVERNAME " - Unable to allocate IRP for sending
URB\n"));
return STATUS_INSUFFICIENT_RESOURCES;
}

KdPrint((DRIVERNAME " - IoBuildDeviceIoControlRequest %X \n",
iostatus.Status));
KdPrint((DRIVERNAME " - IRP Pointer %X \n", irp));

PIO_STACK_LOCATION stack = IoGetNextIrpStackLocation(irp);
stack->Parameters.Others.Argument1 = (PVOID)urb;
stack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
stack->Parameters.DeviceIoControl.IoControlCode =
IOCTL_INTERNAL_USB_SUBMIT_URB;

status = IoCallDriver(pdx->LowerDeviceObject,irp);

KdPrint((DRIVERNAME " - After IoCallDriver %X \n", status));
if(status == STATUS_PENDING)
{
status = KeWaitForSingleObject(
&event,
Executive,
KernelMode,
FALSE,
NULL
);
KdPrint((DRIVERNAME " - Before Assigning status %X \n", status));
KdPrint((DRIVERNAME " - IoBuildDeviceIoControlRequest %X \n",
iostatus.Status));
status = iostatus.Status;
}
*length = urb->UrbBulkOrInterruptTransfer.TransferBufferLength;
KdPrint((DRIVERNAME " - status length %X \n", *length));
KdPrint((DRIVERNAME " - data %X \n", data));
ExFreePool (urb);
KdPrint((DRIVERNAME " - IoBuildDeviceIoControlRequest %X \n",
status));
return status;
}
This is the sample code I got from net,csr application note .I am using
the same code.
Help me find out the prblem.

 >> Stay informed about: Regarding status_unsuccessful+IoCalldriver+UsbBuildVendorR.. 
Back to top
Login to vote
Display posts from previous:   
   Windows XP (Home) -> XP Device Driver All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
  Windows XP
 Windows Vista!
 Win 2000/NT/98/ME


[ Contact us | Terms of Service/Privacy Policy ]