Dear Sir/Madam
Sorry to bother you in your busy office hour.
I try to write a CIR port-driver. I rewrite my own driver based on the WDK IR (SMSCIR) sample code
and the specification –“Implementing an Infrared Remote Control Port Driver for
Windows Media Center for Windows Vista Addendum to the Windows Vista” from Microsoft. .
After my own port driver registering the GUID_DEVINTERFACE_IRPORT interface, my port-driver had
received IOCTL_IR_HANDSHAKE IOCTL from the CIRClass. Then I receive the IOCTL_IR_RECEIVE from the
CIRClass, after I fill data and send return to CIRClass, OS become blue screen.
In my code, when the driver receive the IOCTL_IR_RECEIVE from the CIRClass, own driver fills data
to receiveParams of Circlass driver by the function [SmscIrDequeueRLCData] and return. And the
driver receives the IOCTL_IR_RECEIVE again. The OS [Vista build 5600] become blue screen in a few
time. I guess that the possible root cause for system down maybe the circlass driver.
Here is my code fragment:
Test data: //To simulate the Channel Up RLC data.
UCHAR RLCData=
{
0x35, 0x91, 0x08, 0x88, 0x08, 0x88, 0x08, 0x91, 0x08, 0x91, 0x1A, 0x91, 0x08, 0x88, 0x08, 0x88,
0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88,
0x11, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x91, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88,
0x11, 0x91, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x88, 0x11, 0x88, 0x08, 0x88,
0x08, 0x91, 0x08
}
VOID
SmscIrEvtIoDeviceControl(
IN WDFQUEUE Queue,
IN WDFREQUEST Request,
IN size_t OutputBufferLength,
IN size_t InputBufferLength,
IN ULONG IoControlCode
)
{
…
static int initial = 1;//1: initial
if(initial)
{
deviceData-> Receiver.IsPriorityReceiver = FALSE;
//Fill the Receiver RLC buffer with the test channel up data.
for (index = 0; index < 0x43; index++)
deviceData->Receiver.RLCBuffer[index] = RLCData[index] ;
deviceData->Receiver.CurrentBufferSize = 0x43;
deviceData->Receiver.BytesToDataEnd = 0;
initial = 0;
}
switch (IoControlCode)
{
case IOCTL_IR_RECEIVE: {
IrReceive(deviceData,
Request,
OutputBufferLength);
return;
….
}/*switch*/
….
}/* SmscIrEvtIoDeviceControl*/
VOID IrReceive(PSMSCIR_DATA DeviceData, WDFREQUEST Request, SIZE_T OutputBufferLength)
{
static int myIndex = 0;//0: First 1: Second
capturedByteCount = (ULONG) receiveParams->ByteCount;
…
if (!DeviceData->InPriorityMode)
{
if(myIndex==0)
{
//First Send data amount
DeviceData->Receiver.BytesToDataEnd=0x43;
myIndex++
}
else if(myIndex==1)
{
// Second send data amount:
//
RLCReceiver->BytesToDataEnd -= amountData =3
DeviceData->Receiver.BytesToDataEnd=0x3;
}
/*
-Filling test data to CIRClass Buffer.
-The function will return the data amount that is copied, and set dataEnd (1: Complete).
*/
amountData = SmscIrDequeueRLCData(&DeviceData->Receiver, callersBuffer, capturedByteCount,
&dataEnd);
if (dataEnd || (amountData == capturedByteCount))
{
//
//
Filled the user’s buffer already or we copied up to
// a data end event. Complete the request.
//
/*
SmscIrTracePrint(
TRACE_LEVEL_VERBOSE,
SMSCDBG_IOCTL_INFO,
(“Data was waiting. Completing request.”));
*/
KeReleaseSpinLock(&DeviceData->Receiver.ListSpinLock, oldIrql);
receiveParams->DataEnd = dataEnd;
WdfRequestCompleteWithInformation(Request, STATUS_SUCCESS, amountData);
return;
}
DeviceData->Receiver.CurrentIrReceiveRequest = Request;
DeviceData->Receiver.ReceiveBuffer = callersBuffer;
DeviceData->Receiver.ReceiveBufferSize = capturedByteCount;
DeviceData->Receiver.ReceiveCurrentOffset = amountData;
DeviceData->Receiver.ReceiveParams = receiveParams;
WdfObjectReference(Request);
WdfRequestMarkCancelable(Request, IrReceiveInProgressCancel);
}
}/* IrReceive*/
Would you help me?
Thank you very much.
Dennis Huang
–
http://mymailer.url.com.tw
¥xÆW³Ìª«¶W©ÒȪº¤j²³¤ÆµêÀÀ¶l¥ó¥D¾÷