Oh good. I haven't upgraded my computer to Cyrillic yet.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.
USB HID Library
Re: USB HID Library
Re: USB HID Library
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?
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?
-
- Addict
- Posts: 1443
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: USB HID Library
It is necessary to receive a stream of data from the device and to analyze it.
Re: USB HID Library
Is there a function in your lib, that can detect such a stream of data?
-
- Addict
- Posts: 1443
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: USB HID Library
In "HID module" this function ReadDevice() and GetFeature().
Re: USB HID Library
Thanks, User_Russian, for your information. I will try it ...
Re: USB HID Library
@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()
-
- Addict
- Posts: 1443
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: USB HID Library
"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.
In the loop must be called ReadDevice() or GetFeature() in dependence on, through which channel the data is transmitted.
Re: USB HID Library
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
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
Kindly help me to solve this problem.
Thanks
Deraman
-
- Addict
- Posts: 1443
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: USB HID Library
You are using HID_Module? http://www.purebasic.fr/english/viewtop ... 50#p450450
Re: USB HID Library
Yes Dear!User_Russian wrote:You are using HID_Module? http://www.purebasic.fr/english/viewtop ... 50#p450450
-
- Addict
- Posts: 1443
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: USB HID Library
About what error reports POLINK?
Re: USB HID Library
POLINK: fatal error: Access is denied
Re: USB HID Library
Sometimes your AV is the cause. Try to deactivate your AV and try to compile again.