Page 1 of 1
Support for USB devices in PureBasic?
Posted: Sun Oct 06, 2019 12:35 am
by laserjones
Hello all, I'm considering PureBasic for a cross-platform software project (Windows/Linux), but I could not find information as to whether PureBasic supports communication with USB devices (other than mouse, keyboard, game controllers) out of the box, i.e. without the use of OS APIs. In my case, it's a self-developed USB device using the USB HID standard for sending data to the PC. Are there commands in PureBasic to access such a device directly? I assume I could achieve that via Windows/Linux APIs, but it would be nicer and easier to have platform-independent code.
Re: Support for USB devices in PureBasic?
Posted: Sun Oct 06, 2019 12:55 am
by Tenaja
I don't believe it's in the documentation, but if you try a search you might find something suitable.
Here's an old thread from 2010-2017
viewtopic.php?t=41729
Re: Support for USB devices in PureBasic?
Posted: Sun Oct 06, 2019 1:01 am
by Tenaja
Re: Support for USB devices in PureBasic?
Posted: Sun Oct 06, 2019 1:17 am
by laserjones
Thank you, I meanwhile also found that Russian HID library. However, it seems to be Windows only. I had hoped for something that would fully encapsulate the OS API calls, allowing us to use the same code on all platforms.
Re: Support for USB devices in PureBasic?
Posted: Sun Oct 06, 2019 7:28 am
by Kwai chang caine
Native library will be great and very very usefull...today all is usb
Thanks for the links Tenaja

Re: Support for USB devices in PureBasic?
Posted: Sun Oct 06, 2019 11:02 am
by User_Russian
laserjones wrote:I assume I could achieve that via Windows/Linux APIs
The USB HID API is available on Windows only. On Linux and MacOS X need use libudev.
Re: Support for USB devices in PureBasic?
Posted: Sun Oct 06, 2019 11:36 am
by laserjones
User_Russian wrote:laserjones wrote:I assume I could achieve that via Windows/Linux APIs
The USB HID API is available on Windows only. On Linux and MacOS X need use libudev.
But nevertheless, Linux supports many HID devices (such as mice and keyboards) out of the box, so there should be a way to access HID devices via OS calls on Linux, too. We would need USB-READ() and USB-WRITE() functions in PB that hide these OS-specific aspects from the user.