阅读:925回复:2
关于用DriverStudio如何开发一个USB摄象头驱动
我有一部Windows Mobile手机,我想把上面的USB 摄象头变成电脑上的摄象头,自己写驱动,现在手机侧的驱动和程序已经做好,可以通过USB,端点0和1与PC机批传输通信,我在调试的时候使用的PC上的标准USBIO驱动,在PC上写了个应用可以直接预览到手机上的视频,但是我想做个PC上驱动程序的形式,这样就可以在QQ等聊天工具里调用,我看了DriverStudio相关教程,写了一个USB驱动也可以获取手机传来的USB视频流,另外我还看了DriverStudio里面的关于Stream的虚拟摄象头的例子,还有一个CAM1394的例子,但是还是不知如何把Stream和USB驱动整合在一起变成一个USB摄象头驱动,高手帮帮忙啊
我尝试在Stream例子的KStreamMinidriver类的OnCreateAdapter方法中创建一个PNP的USB传输类,但是一插入手机电脑就蓝屏了,我觉得这样开发的思路是不是有问题,请高手指点一下! NTSTATUS VideoCaptureDriver::OnCreateAdapter( PORT_CONFIGURATION_INFORMATION* pConfigInfo, PVOID AdapterStorage, PHW_STREAM_REQUEST_BLOCK pSrb ) { NTSTATUS ReturnValue = STATUS_SUCCESS; T << TraceInfo << "VideoCaptureDriver::OnCreateAdapter -- Start\n"; // -- since our test driver DOESN'T have hardware, this BETTER be 0! -- if (pConfigInfo->NumberOfAccessRanges != 0) { T << TraceError << "VideoCaptureDriver::OnCreateAdapter -- Illegal port configuration info\n"; return (pSrb->Status = STATUS_NO_SUCH_DEVICE); } // -- construct the adapter using the AdapterStorage memory allocated // by the Class Driver -- m_pAdapter = new (AdapterStorage) VideoCaptureAdapter(this, pConfigInfo); // -- initialize the adapter object and its member streams! -- if (NULL != m_pAdapter) m_pAdapter->Initialize(); else { T << TraceError << "VideoCaptureDriver::OnCreateAdapter -- Adapter constructor failed!\n"; ReturnValue = STATUS_IO_DEVICE_ERROR; } T << TraceInfo << TraceHex << "VideoCaptureDriver::OnCreateAdapter -- End. Status is " << (ULONG)ReturnValue << "\n"; if (ReturnValue!=STATUS_SUCCESS) return ReturnValue; UsbTransferDevice * pDevice = new ( NULL, FILE_DEVICE_UNKNOWN, NULL, 0, DO_DIRECT_IO ) UsbTransferDevice(Pdo, m_Unit); if (pDevice == NULL) { T << "Error creating device UsbTransferDevice" << (ULONG) m_Unit << EOL; return STATUS_INSUFFICIENT_RESOURCES; } NTSTATUS status = pDevice->ConstructorStatus(); if ( !NT_SUCCESS(status) ) { T << "Error constructing device UsbTransferDevice" << (ULONG) m_Unit << " status " << (ULONG) status << EOL; delete pDevice; } else { m_Unit++; } return status; } |
|
沙发#
发布于:2009-08-15 16:02
不建议用这个工具,建议用DDK吧。
你用这个,没有仍帮你回答,因为很少人用。加上这个工具口碑不好 |
|
板凳#
发布于:2009-08-17 15:09
用户被禁言,该主题自动屏蔽! |
|