Giter VIP home page Giter VIP logo

Comments (2)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Public C2 As New USBHIDDRIVER.USBInterface("vid_1781", "pid_07d0")
Public USBbuff(64) As Byte
C2.enableUsbBufferEvent(New System.EventHandler(AddressOf HIDEvent))

Public Sub HIDEvent()
        Dim x As Integer

        'Console.WriteLine("Event Caught")
        If USBHIDDRIVER.USBInterface.usbBuffer.Count > 0 Then
            Console.WriteLine("Event Caught: Buffer Count =" & USBHIDDRIVER.USBInterface.usbBuffer.Count)
            While USBHIDDRIVER.USBInterface.usbBuffer.Count > 0
                USBbuff = USBHIDDRIVER.USBInterface.usbBuffer(0)
                USBHIDDRIVER.USBInterface.usbBuffer.RemoveAt(0)
            End While
        Else
            Console.WriteLine("Event Caught: No Items")
        End If
    End Sub

Original comment by [email protected] on 23 Jan 2013 at 10:24

from csharp-usb-hid-driver.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Public Sub HIDEvent()
        While USBHIDDRIVER.USBInterface.usbBuffer.Count > 0
            USBbuff = USBHIDDRIVER.USBInterface.usbBuffer(0)
            SyncLock (USBHIDDRIVER.USBInterface.usbBuffer.SyncRoot)
                USBHIDDRIVER.USBInterface.usbBuffer.RemoveAt(0)
            End SyncLock
            DataRecieved(USBbuff)

        End While
    End Sub
    Delegate Sub DataRecievedCallback(UsbIN() As Byte)
    Private Sub DataRecieved(ByVal UsbIN() As Byte)
        Dim x As Integer        
        If Me.TextBox_Cell.InvokeRequired Then
            Dim d As New DataRecievedCallback(AddressOf DataRecieved)
            Me.Invoke(d, New Object() {UsbIN})
        Else
           //Process your data of UsbIN here
        End If
    End Sub


I am still having an issue where if a lot of packets come in from the device, I 
will lose some of them. Is there anyway to make sure no packets get lost.

Original comment by [email protected] on 25 Jan 2013 at 1:58

from csharp-usb-hid-driver.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.