如何用usb设备将我的句柄绑定到管道? [英] How to bind my handle to a pipe with usb device ?

查看:84
本文介绍了如何用usb设备将我的句柄绑定到管道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好所有

我使用Create file,Writefile,Readfile与usb设备通信,成功使用Createfile后Writefile需要管道到设备。我试过Createpipe()来创建任何管道和我用带有refrence的Createfile句柄绑定了他的句柄。但它没有用。所以如何将我的Createfile句柄绑定到这个管道或如何使用Createnamedpipe来解决我的问题?

Ps如何制作正确的pipename来自usbpath我有哪些?



我尝试过:



Hanle * g,* f;

句柄h;

h = Createfile(...)

g =& h;

Createpipe(f,g,..)

解决方案

我知道在Windows上与USB设备通信的三个选项:
  • 使用设备制造商提供的带有SDK的设备专用驱动程序

  • 使用具有IOCTL的设备特定驱动程序

  • 使用设备独立的API或库,如 WinUSB libusb


作为起点,您可以阅读 USB桌面应用程序编程参考(Windows驱动程序) [ ^ ]。



对于 WinUSB 示例,请参阅如何使用WinUSB函数访问USB设备Microsoft Docs [ ^ ]和根据WinUSB模板编写Windows桌面应用程序Microsoft Docs [ ^ ]。


Hallo All
I use Create file ,Writefile,Readfile to communicate with a usb device,After using Createfile successfully Writefile needs a pipe to the device .I tried Createpipe() to create anynoumous pipe and I binded his handle with Createfile handle with refrence.but it did not work.So How to bind my Createfile handle to this pipe or How to use Createnamedpipe to solve my problem?
P.s How to make right pipename from usbpath which I have ?

What I have tried:

Hanle *g,*f;
Handle h;
h=Createfile(...)
g=&h;
Createpipe(f,g,..)

解决方案

I know of three options to communicate with USB devices on Windows:
  • Using a device specific driver with an SDK provided by the device manufacturer
  • Using a device specific driver with IOCTLs
  • Using a device independant API or library like WinUSB or libusb

As a starting point you might read USB desktop application programming reference (Windows Drivers)[^].

For WinUSB examples see How to Access a USB Device by Using WinUSB Functions | Microsoft Docs[^] and Write a Windows desktop app based on the WinUSB template | Microsoft Docs[^].


这篇关于如何用usb设备将我的句柄绑定到管道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆