Page 4 of 5

Re: USB HID Library

Posted: Sat Aug 09, 2014 9:44 pm
by chris319
User_Russian wrote:Rename it is not necessary. It is not used in the project. This electrical circuit thermometer device.
The original name Схема_USB_Termo.gif. You can rename it to Circuit_USB_Termo.gif.
Oh good. I haven't upgraded my computer to Cyrillic yet.

Re: USB HID Library

Posted: Wed Aug 13, 2014 2:18 pm
by Susan20
I have a USB-HID footpedal connected to my computer. When I run the DeviceTest-Code, I get the message that device is connected. (by the way: I use the hid_module.pbi and not the lib).
So far so good. But my question is: How can I observe that for example the left pedal is pressed? Is there a function in the hid_module.pbi respectively in the lib, that causes an event, when the left or right pedal is pressed?

Re: USB HID Library

Posted: Wed Aug 13, 2014 3:07 pm
by User_Russian
It is necessary to receive a stream of data from the device and to analyze it.

Re: USB HID Library

Posted: Wed Aug 13, 2014 3:38 pm
by Susan20
Is there a function in your lib, that can detect such a stream of data?

Re: USB HID Library

Posted: Wed Aug 13, 2014 3:46 pm
by User_Russian
In "HID module" this function ReadDevice() and GetFeature().

Re: USB HID Library

Posted: Wed Aug 13, 2014 3:51 pm
by Susan20
Thanks, User_Russian, for your information. I will try it ...

Re: USB HID Library

Posted: Thu Aug 14, 2014 9:29 am
by Susan20
@User_Russian, could you have a quick look at my code? As you said, I try to produce a data stream from the device by the function GetFeature. My hope was, that I can detect this data stream as an event in the repeat-loop. But it didn't work.

Code: Select all

;the IDs of the infinity foot pedal
#USB_PID=$FF
#USB_VID=$5F3

XIncludeFile "HID_Module.pbi"

HID::HID_Init()

hDev = HID::OpenDevice(#USB_PID, #USB_VID) 


OpenWindow(0,0,0,320,100,"HID in action",#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
TextGadget(1,10,10,300,16,"press a pedal")

Global *buffer = AllocateMemory(256)      
HID::GetFeature(hDev, *buffer, 256)
   
Repeat
   Event=WaitWindowEvent()
   Debug event
Until Event=#PB_Event_CloseWindow

HID::HID_End()

Re: USB HID Library

Posted: Thu Aug 14, 2014 12:38 pm
by User_Russian
"HID_Module" does not generate window events.
In the loop must be called ReadDevice() or GetFeature() in dependence on, through which channel the data is transmitted.

Re: USB HID Library

Posted: Thu Aug 14, 2014 3:23 pm
by Susan20
Thanks! I put the ReadDevice function in a thread, which is called by a timer-event. Although I only get one value, which is independent from the pedal action (press, release), I can control the play/stopp-process.

Re: USB HID Library

Posted: Wed Sep 06, 2017 6:49 am
by Deraman
Dear, I am getting POLINK..... error when compiling examples that contain Thread command and procedure, if I remove both the example compile without any error, this is same for HID Lib and module both.
Kindly help me to solve this problem.
Thanks
Deraman

Re: USB HID Library

Posted: Wed Sep 06, 2017 10:52 am
by User_Russian

Re: USB HID Library

Posted: Wed Sep 06, 2017 2:18 pm
by Deraman
User_Russian wrote:You are using HID_Module? http://www.purebasic.fr/english/viewtop ... 50#p450450
Yes Dear!

Re: USB HID Library

Posted: Wed Sep 06, 2017 2:58 pm
by User_Russian
About what error reports POLINK?

Re: USB HID Library

Posted: Wed Sep 06, 2017 3:01 pm
by Deraman
POLINK: fatal error: Access is denied

Re: USB HID Library

Posted: Wed Sep 06, 2017 5:45 pm
by Bisonte
Sometimes your AV is the cause. Try to deactivate your AV and try to compile again.