i am unable to send the proper character, it is printing junk characters in the remote system
Even i checked with the IOCTL_LINE_CONTROL, Baudrate.. everything is correct
plz help me out, how do i proceed, or give some hints,
the sample code is below.....
NTSTATUS
WriteUrb(
PDEVICE_EXTENSION Extension
)
{
USBD_PIPE_HANDLE PipeHandle;
BOOLEAN startirp;
KIRQL oldirql;
PIRP Irp;
PURB urb;
PIO_STACK_LOCATION stack;
if (Extension->writepending)
startirp = FALSE;
else
startirp = TRUE, Extension->writepending = TRUE;
if (!startirp)
return STATUS_DEVICE_BUSY;
Irp = Extension->WritingIrp;
urb = Extension->WritingUrb;
PipeHandle = Extension->UsbInterface->Pipes[Extension->DataOutPipe].PipeHandle;
ASSERT(Irp && urb);
// Initialize the URB we use for reading the interrupt pipe
UsbBuildInterruptOrBulkTransferRequest(
urb,
sizeof (struct _URB_BULK_OR_INTERRUPT_TRANSFER),
PipeHandle,
Extension->WriteCurrentChar,
NULL,
Extension->WriteSize,
USBD_TRANSFER_DIRECTION_OUT,
NULL);
// Install "OnInterrupt" as the completion routine for the polling IRP.
IoSetCompletionRoutine(
Irp,
(PIO_COMPLETION_ROUTINE) OnWriteInterrupt,
Extension,
TRUE,
TRUE,
TRUE);
// Initialize the IRP for an internal control request
stack = IoGetNextIrpStackLocation(Irp);
stack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
stack->Parameters.DeviceIoControl.IoControlCode = IOCTL_INTERNAL_USB_SUBMIT_URB;
stack->Parameters.Others.Argument1 = urb;
Irp->Cancel = FALSE;
return IoCallDriver(Extension->TopOfStackDeviceObject, Irp);
}
|