Platforms to show: All Mac Windows Linux Cross-Platform

/USB/HID Linux/USB HID Devices Linux


Required plugins for this example: MBS USB Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /USB/HID Linux/USB HID Devices Linux

This example is the version from Sun, 17th Mar 2012.

Project "USB HID Devices Linux.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open() if not TargetLinux then MsgBox "This application requires Linux." quit end if // check platform dim s as new Shell s.Execute "uname -m" if s.Result = "x86_64" then MsgBox "The HID class works only on 32 bit linux systems. It will work on 64 bit Linux once REAL Studio creates true 64 bit applications." quit end if End EventHandler
End Class
Class Window1 Inherits Window
Control Listbox1 Inherits Listbox
ControlInstance Listbox1 Inherits Listbox
End Control
EventHandler Sub Open() dim h as new hid call h.Open(0, h.kMatchAny, h.kMatchAny) End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class HID Inherits LinuxHIDInterfaceMBS
EventHandler Function MatchDevice(usbdev as LinuxUSBDeviceHandleMBS) As boolean dim l as Listbox = window1.Listbox1 dim d as LinuxUSBDeviceDescriptionMBS = usbdev.Device.Descriptor l.AddRow d.ProductName l.cell(l.LastIndex,1)=d.Manufacturer l.cell(l.LastIndex,2)=d.SerialNumber l.cell(l.LastIndex,3)=str(d.Product) l.cell(l.LastIndex,4)=str(d.Vendor) dim s as string dim n as integer = d.DeviceClass Select case n case d.kDeviceClassAudio s = " Audio" case d.kDeviceClassCOMM s = " COMM" case d.kDeviceClassDATA s = " DATA" case d.kDeviceClassHID s = " HID" case d.kDeviceClassHUB s = " HUB" case d.kDeviceClassMassStorage s = " MassStorage" case d.kDeviceClassPrinter s = " Printer" else s = " ?" end Select l.cell(l.LastIndex,5)=str(n)+s l.cell(l.LastIndex,6)=str(d.DeviceSubClass) l.cell(l.LastIndex,7)=str(d.DeviceProtocol) l.cell(l.LastIndex,8)=str(d.MaxPacketSize0) Exception End EventHandler
End Class
End Project

See also:

The items on this page are in the following plugins: MBS USB Plugin.


The biggest plugin in space...