Results 1 to 7 of 7

Thread: accessing USB HID device

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    accessing USB HID device

    Hi All,

    This is driving me nuts, I have a DYMO postal scale which comes with USB. I wish to read the weight into my application.

    The DYMO website has a app called InstaRate which can read the weight fine so it can be done. however no mention of how to.

    The scale installs itself as a HID device, I have tried to find examples of how to read these but cant find anything that works (or understand it).

    This code can find the device but provides no way to read as far as i can see
    Code:
    Imports SimpleHID
    Public Class Form1
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim infoSetsForAllDevices = HIDManager.GetInfoSets()
            For Each sss In infoSetsForAllDevices
                ListBox1.Items.Add(sss.ProductString)
                Dim device = New HIDDevice()
                device.Init(sss.DevicePath)
            Next
        End Sub
    End Class
    can someone please help me figure this out? i feel im close but have reached the end of my rope
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: accessing USB HID device

    What are the other methods apart from Init available for device?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: accessing USB HID device

    the whole list (not just methods)

    -Dispose
    -Equals
    -FeatureButtonCaps
    -FeatureValueCaps
    -GetHashcode
    -GetType
    -HidCaps
    -Init
    -InputButtonCaps
    -InputValueCaps
    -OutputButtonCaps
    -OutputValueCaps
    -ReadInputReport
    -ReferanceEquals
    -ToString
    -WriteOutputReport

    im assuming its got to do with writeoutputreport but it wants values that i have no idea on.......
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

  4. #4
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: accessing USB HID device

    Maybe it is WriteOutputReport(sss.something)?

    Edit:

    Not sure if Reading a Stamps.com USB Scale from C# will be of use or not? Yes, I know the code is in C# but you might see similarities between that and what you want to do.
    Last edited by Nightwalker83; Oct 6th, 2014 at 03:54 AM. Reason: Adding more!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  5. #5
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,543

    Re: accessing USB HID device

    why would it be write? wouldn't it be the read method? You want to READ the scale... no?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: accessing USB HID device

    Quote Originally Posted by techgnome View Post
    why would it be write? wouldn't it be the read method? You want to READ the scale... no?
    The way I look at it is that the machine allows you to load the input back in to the machine and that is where "ReadInputReport" is used.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: accessing USB HID device

    well that method was part of someones libaray. I saw the stamps link before but couldnt compile a dll for mike obriens libaray but got an older version and managed to, so for all out there the libaray is at: https://github.com/mikeobrien/HidLibrary and the code i used is as follows

    Code:
    Imports HidLibrary
    Public Class Form1
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim inData As HidDeviceData
            Dim scale As HidDevice
            Dim weight As Decimal
            'USB\VID_0922&PID_8004
            scale = HidDevices.Enumerate(&H922, &H8004).FirstOrDefault 'VID and PID from device manager
            If scale IsNot Nothing Then
                scale.OpenDevice()
                inData = scale.Read(250)
                 weight = Convert.ToDecimal(inData.Data(4)) + (Convert.ToDecimal(inData.Data(5) * 255) + Convert.ToDecimal(inData.Data(5)))
                ListBox1.Items.Add(weight)
                scale.CloseDevice()
                scale.Dispose()
            End If
        End Sub
    End Class
    Last edited by bensonsearch; Oct 6th, 2014 at 08:52 PM.
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width