最近在用C#调试USB程序,libusb源码是C语言的,C#用起来不方便,偶然在网上看到了LibUsbDotNet,这是开源的项目,下载后参考Example,用起来非常方便。
LibUsbDotNet下载 - http://sourceforge.net/projects/libusbdotnet/
我写的示例工程(附件传不上来,只能直接贴代码了^_^) - Enjoy...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using LibUsbDotNet;
using LibUsbDotNet.Info;
using LibUsbDotNet.Main;
using LibUsbDotNet.DeviceNotify;
using LibUsbDotNet.LibUsb;
namespace USBLib
{
public partial class Form1 : Form
{
const int myPID = 0x050F; //产品ID
const int myVID = 0x0425; //供应商ID
public static UsbDevice MyUsbDevice;//USB设备
public static DeviceNotifier DeviceNotifier = new DeviceNotifier();//设备变化通知函数
public static UsbEndpointWriter writer = null;
public static UsbEndpointReader reader = null;
delegate void SetTextCallback(string text);//安全线程访问txtReadInt的值
Boolean EnbaleInt = false;//是否使用中断接收
public Form1(
LibUsbDotNet下载 - http://sourceforge.net/projects/libusbdotnet/
我写的示例工程(附件传不上来,只能直接贴代码了^_^) - Enjoy...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using LibUsbDotNet;
using LibUsbDotNet.Info;
using LibUsbDotNet.Main;
using LibUsbDotNet.DeviceNotify;
using LibUsbDotNet.LibUsb;
namespace USBLib
{
public partial class Form1 : Form
{
const int myPID = 0x050F; //产品ID
const int myVID = 0x0425; //供应商ID
public static UsbDevice MyUsbDevice;//USB设备
public static DeviceNotifier DeviceNotifier = new DeviceNotifier();//设备变化通知函数
public static UsbEndpointWriter writer = null;
public static UsbEndpointReader reader = null;
delegate void SetTextCallback(string text);//安全线程访问txtReadInt的值
Boolean EnbaleInt = false;//是否使用中断接收
public Form1(