English
Forum

USB read ...

 
- Page 1 -



Erasmus.Herold
Hello dear Community.

want it of these Topic once more quite different try, To Help come. The COM interface on the PC auszulesen is with XProfan simply.

How see it from with the USB interface?
has someone itself on it attempts and has Codeschnipsel for me?

Please no Discussion circa driver, Windowshoheiten or USB2COM Adapter, separate To this Thread Please only whom replacement, whether someone with XProfan USB directly read can.

thanks you.
 
05/04/19  
 



« this Posting watts as Solution marked. »

- Page 3 -



Paul
Glatz
The "1995378067" in hScanner& is a lever the unit and will between Program- or Computerneustarts Change.
The Gerätename (\\?\HID#VID_????&PID_????...) ought to konstant stay.

i'm no Possibility famous the value view. but The VID/PID sees one in tools-manager under "Hardware-IDs".
 
05/06/19  
 



 
- Page 2 -



Paul
Glatz
having I forget. have whom Download now added.
 
05/06/19  
 




Erasmus.Herold
sees then so from ...

 
05/06/19  
 



 
- Page 3 -



Erasmus.Herold
Note:

presently is it so, alike, whether I supra no (!) USB Device auswähle, whether I The keyboard dial, or whom USB Scanner ....

... if I over keyboard a input make, appear the ASCII code without that the Cursor glint must.

The registration is so good (because blind), but it'll not yet on one festes USB Device fixes.

Greeting and Thanks
 
05/06/19  
 




Paul
Glatz
The RawInput informations have I to the Filtern outputted.

here again a new Version, The with my Tests zuverlässiger on the Scanner reacted.

Download

here another video, as functions should: Download

The new version shows RawInput informations only yet for the chosen unit.

 
05/06/19  
 




Erasmus.Herold
with video? integrally large cinema!!!

my Result:
I dial now my USB Scanner.
make a input.
After the "Enter" the Scanners come The data.
lastly the entire String.

the sees already time very well from.
as nächstes teste I the time with a USB (HID) RFID-Reader.

next feedback follows.
 
05/06/19  
 




Erasmus.Herold
... and again a step moreover.

my video with ausgelesenen RFID Tags find You here: [...] 
 
05/06/19  
 




Erasmus.Herold
I bastle on your code rum and minimiere me time, I need.
the Result there then later back.

hScanner& takes by me for associated USB Scanner whom
worth 1995378067 on. above it can I the unit fix read.

can I this worth too independent of XProfan for Zuweisung
under windows find or discern?

target would a solid default the USB Ports and not The selection all
 
05/06/19  
 




Paul
Glatz
The "1995378067" in hScanner& is a lever the unit and will between Program- or Computerneustarts Change.
The Gerätename (\\?\HID#VID_????&PID_????...) ought to konstant stay.

i'm no Possibility famous the value view. but The VID/PID sees one in tools-manager under "Hardware-IDs".
 
05/06/19  
 




H.Brill
wow, sees already time well from.
Perhaps time in the Registry Ausschau hold : [...] 
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
05/06/19  
 




Erasmus.Herold
lovely.

1. then I will whom Scanner tommorrow time over its solid definierten Gerätenamen pack ...

2. ... and the EANs in a list box collect.

my feedback becomes follow.

thanks you.
 
05/06/19  
 




Erasmus.Herold
enclosed now time my angepasster Test-Source with solid vorgegebenem USB Anschluss. the Reading via Barcode-Scanner and RFID Reader (see video moreover supra) functions super.

in the next level follows now The Implementierung in that "RFID management Studio". further feedback becomes follow. thanks !!!
Window Title "RawInput"
Window 1000, 600
SubClass %HWnd, 1
'=======================================================================================================================================================
'=== VARIABLEN DEKLARIEREN =============================================================================================================================
'=======================================================================================================================================================
Struct RAWINPUTDEVICE = usUsagePage%, usUsage%, dwFlags&, hwndTarget&
Struct RAWINPUTKEYBOARD = dwType&, dwSize&, hDevice&, wParam&, MakeCode%, ? Happen?%, Reserved%, VKey%, Message&, ExtraInformation&
Def RegisterRawInputDevices(3) !"User32", "RegisterRawInputDevices"
Def GetRawInputData(5) !"User32", "GetRawInputData"
Def GetRawInputDeviceList(3) !"User32", "GetRawInputDeviceList"
Def GetRawInputDeviceInfoA(4) !"User32", "GetRawInputDeviceInfoA"
Declare hScanner&, CodeStatus%, CodeFocus&, hDev&
Declare HID_Geraet_Nr&, HID_Geraet_temporaere_ID&, counter&
// RawInput Register
Declare rid#
Dim rid#, RAWINPUTDEVICE
rid#.usUsagePage% = 1// RegisterRawInputDevices
rid#.usUsage% = 6// Keyboard
rid#.dwFlags& = 0// $30 /* RIDEV_NOLEGACY */
rid#.hwndTarget& = %hwnd

Ifnot RegisterRawInputDevices(rid#, 1, SizeOf(rid#))

    MessageBox("RawInput couldn't registered go " + Hex$(%WinError), "", 0)

EndIf

HID_Geraet_Nr& = 1
'=======================================================================================================================================================
'=== PROCEDUREN ANLEGEN ================================================================================================================================
'=======================================================================================================================================================

Proc AddDevices_USB

    Parameters hList&
    Declare numDevices&, devices#, hDevice&
    GetRawInputDeviceList(0, Addr(numDevices&), 8)

    If numDevices& = 0

        Return

    EndIf

    Dim devices#, numDevices& * 8
    GetRawInputDeviceList(devices#, Addr(numDevices&), 8)
    counter& = 1

    WhileLoop 0,numDevices& - 1

        If Long(devices#, (&Loop * 8) + 4) = 1/* RIM_TYPEKEYBOARD */

            hDevice& = Long(devices#, &Loop * 8)
            AddStrings(hList&, GetDeviceName_USB(hDevice&) + "|" + Str $(hDevice&))
            // ALLE USB-PORTS ANZEIGEN
            print "benutzte USB-Ports: ", GetDeviceName_USB(hDevice&) + "|" + Str $(hDevice&)

            if (counter& = HID_Geraet_Nr&)

                HID_Geraet_temporaere_ID& = hDevice&

            endif

            counter& = counter& + 1

        EndIf

        // ALLE USB-PORTS ANZEIGEN
        'print "alle USB-Ports: ", GetDeviceName_USB(hDevice&)

    EndWhile

    // GEWÄLTE TEMPORÄRE HID ID ANZEIGEN
    print : print "benutzt becomes these temporary HID ID [" + st$(HID_Geraet_Nr&) + "]: " + st$(HID_Geraet_temporaere_ID&)

ENDPROC

Proc GetDeviceName_USB

    Parameters hdev&
    Declare buf#, len&
    GetRawInputDeviceInfoA(hdev&, $20000007  0, Addr(len&))/* RIDI_DEVICENAME */

    If len& = 0

        Return ""

    EndIf

    Dim buf#, len&
    GetRawInputDeviceInfoA(hdev&, $20000007  buf#, Addr(len&))/* RIDI_DEVICENAME */
    'print "hdev: ", hdev&
    'print "Add: ", GetDeviceName_USB(hDevice&)
    Return String $(buf#, 0)

ENDPROC

SubClassProc

    // The procedure, to the at Subclassing any Messages detoured go,
    // for its Window or, Dialogelement the Subclassing eingeschaltet is.

    If SubClassMessage(%hWnd, $00ff/* WM_INPUT */

        Declare raw#
        Dim raw#, RAWINPUTKEYBOARD
        Var size& = SizeOf(raw#)

        Ifnot GetRawInputData(&sLParam, $10000003  raw#, addr(size&), 16) == -1/* RID_INPUT */

            If (raw#.hDevice& = HID_Geraet_temporaere_ID&) AND ((raw#.flags% & 1  = 0)/* RI_KEY_BREAK */

                'SetText hLog&, GetText$(hLog&) + "RawInput: unit: " + Str$(raw#.hDevice&) + " Button: " + Str$(raw#.VKey%) + " ? Happen?: " + Str$(raw#.flags%) + "\n"

                Ifnot GetFocus(hCode&)

                    CodeFocus& = %GetFocus
                    SetFocus(hCode&)
                    SetText hCode&, ""

                EndIf

                If (raw#.VKey% = 13) OR (raw#.VKey% = 9)// scancode 13 = Enter  9 = tab

                    SetMenuItem 1234

                EndIf

            EndIf

        EndIf

    EndIf

ENDPROC

'=======================================================================================================================================================
'=== HAUPTPROGRAMM =====================================================================================================================================
'=======================================================================================================================================================
'hDev& = Create("ChoiceBox", %hwnd, 1, 5, 25, Width(%hwnd) - 10, 300)
// USB DEVICES ERMITTELN
AddDevices_USB hDev&
Var hCode& = Create("Edit", %hwnd, "", 2000, 2000, 0, 0)// Verstecktes Text box for Barcodeeingabe
Var hLog& = Create("MultiEdit", %hwnd, "", 5, 120, Width(%hwnd) - 10, Height(%hwnd) - 125)
// Hauptschleife

While 1

    WaitInput

    If Clicked(hDev&)

        hScanner& = Val(SubStr$(GetText$(hDev&), 2, "|"))

    ElseIf %MenuItem = 1234

        SetFocus(CodeFocus&)
        CodeFocus& = 0
        SetText hLog&, GetText$(hLog&) + "Barcode red: " + GetText$(hCode&) + "\n"

    EndIf

EndWhile

 
05/08/19  
 




Erasmus.Herold
Update:

In Anlehnung on Pauls ideas is now one USB_Port_Viewer emerged.

this Program recognize any vorhandenen USB Ports in a system, shows The used Ports on and supply The benötigte temporary ID for Reading in the background.

enclosed the program velvet Source.


 
05/08/19  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

20.398 Views

Untitledvor 0 min.
Member 862464105/20/24
Sven Bader07/03/23
H.Brill05/14/23
Normann Strübli01/30/23
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie