社区
下载资源悬赏专区
帖子详情
generic_hid_vb下载
weixin_39821260
2019-07-11 10:00:14
generic hid control,find your HID device and your can read and write command to test.
相关下载链接:
//download.csdn.net/download/pinliao/3017728?utm_source=bbsseo
...全文
11
回复
打赏
收藏
generic_hid_vb下载
generic hid control,find your HID device and your can read and write command to test. 相关下载链接://download.csdn.net/download/pinliao/3017728?utm_source=bbsseo
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
generic
_
hid
_
vb
generic
hid
control,find your
HID
device and your can read and write command to test.
usb communication
利用USB接口进行通信的数据源码MemberIndex = 0 Do 'The cbSize element of the MyDeviceInterfaceData structure must be set to 'the structure's size in bytes. The size is 28 bytes. MyDeviceInterfaceData.cbSize = LenB(MyDeviceInterfaceData) Result = SetupDiEnumDeviceInterfaces _ (DeviceInfoSet, _ 0, _
Hid
Guid, _ MemberIndex, _ MyDeviceInterfaceData) Call DisplayResultOfAPICall("SetupDiEnumDeviceInterfaces") If Result = 0 Then LastDevice = True 'If a device exists, display the information returned. If Result <> 0 Then lstResults.AddItem " DeviceInfoSet for device #" & CStr(MemberIndex) & ": " lstResults.AddItem " cbSize = " & CStr(MyDeviceInterfaceData.cbSize) lstResults.AddItem _ " InterfaceClassGuid.Data1 = " & Hex$(MyDeviceInterfaceData.InterfaceClassGuid.Data1) lstResults.AddItem _ " InterfaceClassGuid.Data2 = " & Hex$(MyDeviceInterfaceData.InterfaceClassGuid.Data2) lstResults.AddItem _ " InterfaceClassGuid.Data3 = " & Hex$(MyDeviceInterfaceData.InterfaceClassGuid.Data3) lstResults.AddItem _ " Flags = " & Hex$(MyDeviceInterfaceData.Flags) '****************************************************************************** 'SetupDiGetDeviceInterfaceDetail 'Returns: an SP_DEVICE_INTERFACE_DETAIL_DATA structure 'containing information about a device. 'To retrieve the information, call this function twice. 'The first time returns the size of the structure in Needed. 'The second time returns a pointer to the data in DeviceInfoSet. 'Requires: 'A DeviceInfoSet returned by SetupDiGetClassDevs and 'an SP_DEVICE_INTERFACE_DATA structure returned by SetupDiEnumDeviceInterfaces. '******************************************************************************* MyDeviceInfoData.cbSize = Len(MyDeviceInfoData) Result = SetupDiGetDeviceInterfaceDetail _ (DeviceInfoSet, _ MyDeviceInterfaceData, _ 0, _ 0, _ Needed, _ 0) DetailData = Needed Call DisplayResultOfAPICall("SetupDiGetDeviceInterfaceDetail") lstResults.AddItem " (OK to say too small)" lstResults.AddItem " Required buffer size for the data: " & Needed 'Store the structure's size. MyDeviceInterfaceDetailData.cbSize = _ Len(MyDeviceInterfaceDetailData) 'Use a byte array to allocate memory for 'the MyDeviceInterfaceDetailData structure ReDim DetailDataBuffer(Needed) 'Store cbSize in the first four bytes of the array. Call RtlMoveMemory _ (DetailDataBuffer(0), _ MyDeviceInterfaceDetailData, _ 4) 'Call SetupDiGetDeviceInterfaceDetail again. 'This time, pass the address of the first element of DetailDataBuffer 'and the returned required buffer size in DetailData. Result = SetupDiGetDeviceInterfaceDetail _ (DeviceInfoSet, _ MyDeviceInterfaceData, _ VarPtr(DetailDataBuffer(0)), _ DetailData, _ Needed, _ 0) Call DisplayResultOfAPICall(" Result of second call: ") lstResults.AddItem " MyDeviceInterfaceDetailData.cbSize: " & _ CStr(MyDeviceInterfaceDetailData.cbSize) 'Convert the byte array to a string. DevicePathName = CStr(DetailDataBuffer()) 'Convert to Unicode. DevicePathName = StrConv(DevicePathName,
vb
Unicode) 'Strip cbSize (4 bytes) from the beginning. DevicePathName = Right$(DevicePathName, Len(DevicePathName) - 4) lstResults.AddItem " Device pathname: " lstResults.AddItem " " & DevicePathName '****************************************************************************** 'CreateFile 'Returns: a handle that enables reading and writing to the device. 'Requires: 'The DevicePathName returned by SetupDiGetDeviceInterfaceDetail. '******************************************************************************
Hid
Device = CreateFile _ (DevicePathName, _
GENERIC
_READ Or
GENERIC
_WRITE, _ (FILE_SHARE_READ Or FILE_SHARE_WRITE), _ 0, _ OPEN_EXISTING, _ 0, _ 0) Call DisplayResultOfAPICall("CreateFile") lstResults.AddItem " Returned handle: " & Hex$(
Hid
Device) & "h" 'Now we can find out if it's the device we're looking for. '****************************************************************************** '
Hid
D_GetAttributes 'Requests information from the device. 'Requires: The handle returned by CreateFile. 'Returns: an
HID
D_ATTRIBUTES structure containing 'the Vendor ID, Product ID, and Product Version Number. 'Use this information to determine if the detected device 'is the one we're looking for. '****************************************************************************** 'Set the Size property to the number of bytes in the structure. DeviceAttributes.Size = LenB(DeviceAttributes) Result =
Hid
D_GetAttributes _ (
Hid
Device, _ DeviceAttributes) Call DisplayResultOfAPICall("
Hid
D_GetAttributes") If Result <> 0 Then lstResults.AddItem "
HID
D_ATTRIBUTES structure filled without error." Else lstResults.AddItem " Error in filling
HID
D_ATTRIBUTES structure." End If lstResults.AddItem " Structure size: " & DeviceAttributes.Size lstResults.AddItem " Vendor ID: " & Hex$(DeviceAttributes.VendorID) lstResults.AddItem " Product ID: " & Hex$(DeviceAttributes.ProductID)
USB
HID
通讯的例子,
VB
.net下使用
Imports System.ComponentModel Imports System.Collections.
Generic
Imports System.IO Imports System.Runtime.InteropServices Imports System.Management Imports Microsoft.VisualBasic Imports System.D
HID
报告描述符详解
概述: 报告在这里意思是数据传输(data transfer),而报告描述符是对这些传输的数据作用途(usage)上的说明。 USB通讯协议的规范是以1ms产生一个USB帧(frame),USB设备可以每一个帧中发送和接收一个交换(transaction)。交换是由几个封包(packet)组成,而传输是由一个或几个交换来完成传送一口中有效的数据。在这里,传输和报告的意思相类似。
USB
HID
设备报告描述符详解
报告在这里意思是数据传输(data transfer),而报告描述符是对这些传输的数据作用途(usage)上的说明。USB通讯协议的规范是以1ms产生一个USB帧(frame),USB设备可以每一个帧中发送和接收一个交换(transaction)。交换是 由几个封包(packet)组成,而传输是由一个或几个交换来完成传送一口中有效的数据。在这里,传输和报告的意思相类似。传输方式有四种,初始学一般只...
下载资源悬赏专区
12,886
社区成员
12,438,280
社区内容
发帖
与我相关
我的任务
下载资源悬赏专区
CSDN 下载资源悬赏专区
复制链接
扫一扫
分享
社区描述
CSDN 下载资源悬赏专区
其他
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章