Direct support for USB HID devices

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
laserjones
New User
New User
Posts: 7
Joined: Sat Sep 05, 2009 11:08 pm

Direct support for USB HID devices

Post by laserjones »

It would be great if PureBasic offered functions to access USB HID (Human Interface Devices) directly. HID drivers are included with Windows and other operating systems (they are used by mouse and keyboard, for example), but they are non-trivial to use and they are not cross-platform.

So if PureBasic offered a command layer (preferably platform-independent) that made accessing such devices easy, that would really boost the range of possible applications, especially for people who build their own USB devices (which is rather easy with modern microcontrollers such as PIC).

Adding the serial port library to PureBasic was a step in the right direction, but the serial port is being increasingly replaced by USB ...
UserOfPure
Enthusiast
Enthusiast
Posts: 469
Joined: Sun Mar 16, 2008 9:18 am

Re: Direct support for USB HID devices

Post by UserOfPure »

Did you mean for webcams and stuff? There's examples here on how to access webcams, so maybe that code will point you in the right direction?
laserjones
New User
New User
Posts: 7
Joined: Sat Sep 05, 2009 11:08 pm

Post by laserjones »

I would be surprised if webcams use the HID class, most of them come with their own drivers, I think (correct me if I'm wrong). HID is a generic USB access method that does not require special device drivers, because everything is included with the operating system. But it is not easy to use the HID DLLs (and, of course, tehy are Windows only), so it would be great if PureBasic could encapsulate HID access in a set of easy-to-use commands.

For me it is mainly interesting to use HID for self-built devices based on PIC microcontrollers. I found a way to access them using a third-party library (mcHID.dll), but this is not an elegant solution, and not platform-independent.
User avatar
DoubleDutch
Addict
Addict
Posts: 3219
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: Direct support for USB HID devices

Post by DoubleDutch »

I agree, support for USB HID would be good.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
dhouston
Enthusiast
Enthusiast
Posts: 430
Joined: Tue Aug 21, 2007 2:44 pm
Location: USA (Cincinnati)
Contact:

Re: Direct support for USB HID devices

Post by dhouston »

http://davehouston.org
Mac Mini (Intel) 10.6.8 - iMac G4 (PPC) 10.4.11
Dell Dimension 2400 W98SE,W2K,XP,Vista,W7,Debian,Ubuntu,Kubuntu,Xubuntu,Fedora,Mandriva,Mint
(on swappable HDDs)
Vizio VTAB1008 - Android 3.1
MK808 miniAndroidPC (Android 4.1)
xorc1zt
Enthusiast
Enthusiast
Posts: 276
Joined: Sat Jul 09, 2011 7:57 am

Re: Direct support for USB HID devices

Post by xorc1zt »

On Windows you can use DirectInput from DirectX or RawInput from Windows APIs.

raw http://msdn.microsoft.com/en-us/library ... 85%29.aspx
direct http://msdn.microsoft.com/en-us/library ... 85%29.aspx
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Direct support for USB HID devices

Post by User_Russian »

I agree, support for USB HID would be good.
There is a library, PureBasic for Windows
http://www.purebasic.fr/english/viewtop ... 14&t=41729
Golfy
User
User
Posts: 97
Joined: Wed Mar 21, 2012 6:10 pm

Re: Direct support for USB HID devices

Post by Golfy »

I've just found this post, so I'll deleted my last request about USB description... :)
It would be smart to have Unix/Windows/Mac same function's ;)

And as I can see, this post has been viewed a lot of time :wink:
Golfy
User
User
Posts: 97
Joined: Wed Mar 21, 2012 6:10 pm

Re: Direct support for USB HID devices

Post by Golfy »

Is this request completed ? no way to know where it is ? it's 6 years ago...
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: Direct support for USB HID devices

Post by RSBasic »

If a wish is too old, then Fred doesn't look in because it is time consuming to check very old threads.
It makes more sense to recreate the wish later after many years.

+1 for USB HID devices support.
Image
Image
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Direct support for USB HID devices

Post by User_Russian »

There is a cross-platform library HIDAPI. https://github.com/signal11/hidapi
Perhaps it can be used with PB.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: Direct support for USB HID devices

Post by Lunasole »

+1, that might be actual addition to PB in a "hardware" direction. All those widely-popular webcameras, gamepads or becoming popular fingerprint scanners, other scanners, etc, or even stuff like robots/drones, looks nice to access them directly out-of-the-box.
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
Post Reply