Support for USB devices in PureBasic?

Everything else that doesn't fall into one of the other PB categories.
laserjones
New User
New User
Posts: 7
Joined: Sat Sep 05, 2009 11:08 pm

Support for USB devices in PureBasic?

Post 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.
User avatar
Tenaja
Addict
Addict
Posts: 1948
Joined: Tue Nov 09, 2010 10:15 pm

Re: Support for USB devices in PureBasic?

Post 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
User avatar
Tenaja
Addict
Addict
Posts: 1948
Joined: Tue Nov 09, 2010 10:15 pm

Re: Support for USB devices in PureBasic?

Post by Tenaja »

laserjones
New User
New User
Posts: 7
Joined: Sat Sep 05, 2009 11:08 pm

Re: Support for USB devices in PureBasic?

Post 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.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Support for USB devices in PureBasic?

Post by Kwai chang caine »

Native library will be great and very very usefull...today all is usb :|
Thanks for the links Tenaja 8)
ImageThe happiness is a road...
Not a destination
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Support for USB devices in PureBasic?

Post 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.
laserjones
New User
New User
Posts: 7
Joined: Sat Sep 05, 2009 11:08 pm

Re: Support for USB devices in PureBasic?

Post 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.
Post Reply