It is currently Thu Jun 20, 2013 4:07 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: USB HID Library
PostPosted: Sun Aug 21, 2011 7:19 pm 
Offline
User
User

Joined: Wed Aug 03, 2011 4:52 am
Posts: 98
Location: Beirut, Lebanon
in the english help and other examples, all text strings are not english, (russian may be) like :
SetGadgetText(1,"Ïîäêëþ÷åíî HID óñòðîéñòâî")

do you have any translation for that??

thanks

_________________
PureBasic: Surprisingly simple, diabolically powerful


Top
 Profile  
 
 Post subject: Re: USB HID Library
PostPosted: Mon Aug 22, 2011 8:18 am 
Offline
User
User

Joined: Sun Jun 15, 2008 3:13 am
Posts: 32
Location: Russia
I only have translated messages into English.
I hope, it will help you.

Device_IO.pb
Code:
#USB_PID=1
#USB_VID=$1234
Global W_DeviceHandle=0, R_DeviceHandle=0

Procedure FindDevice_Timer()
Static Old_Test
Test=HID_Lib_DeviceTest(#USB_PID, #USB_VID)
 If Test<>Old_Test
  Old_Test=Test
  If Test
     HID_Lib_CloseDevice(W_DeviceHandle)
     HID_Lib_CloseDevice(R_DeviceHandle)
     W_DeviceHandle=HID_Lib_OpenDevice(#USB_PID, #USB_VID)
     R_DeviceHandle=HID_Lib_OpenDevice(#USB_PID, #USB_VID)
     SetGadgetText(1,"HID device is connected")
  Else
     HID_Lib_CloseDevice(W_DeviceHandle)
     HID_Lib_CloseDevice(R_DeviceHandle)
     W_DeviceHandle=0 : R_DeviceHandle=0
     SetGadgetText(1,"Device not found ( PID — "+Hex(#USB_PID)+"H;  VID — "+Hex(#USB_VID)+"H) ")
     SetGadgetText(5,"No")
  EndIf
 EndIf
EndProcedure

Procedure SendDevice(Command.w)
 If W_DeviceHandle
   HID_Lib_WriteDevice(W_DeviceHandle, @Command,2)
 Else
   MessageRequester("", "There is no communication with the device!", #MB_OK|#MB_ICONWARNING)
 EndIf
EndProcedure

Procedure Thread(*xx)
Dim InBuffer.b(2)
 Repeat
   If R_DeviceHandle
     HID_Lib_ReadDevice(R_DeviceHandle, @InBuffer(), 2)
       If InBuffer(1)=20
         SetGadgetText(5,"Да")
       ElseIf InBuffer(1)=40
         SetGadgetText(5,"Нет")
       EndIf
   EndIf
   Delay(10)
 ForEver
EndProcedure

OpenWindow(0,0,0,320,100,"HID example",#PB_Window_MinimizeGadget|#PB_Window_Invisible|#PB_Window_ScreenCentered)
   TextGadget(1,10,10,300,16,"The device isn't found ( PID — "+Hex(#USB_PID)+"H;  VID — "+Hex(#USB_VID)+"H )",#PB_Text_Center)
   ButtonGadget(2,40,70,120,24,"Turn LED On")
   ButtonGadget(3,170,70,120,24,"Turn LED Off")
   TextGadget(4,50,40,98,16,"Is button pressed?")
   StringGadget(5,140,36,40,20,"No",1|#PB_String_ReadOnly)
FindDevice_Timer()
HideWindow(0,0)
SetTimer_(WindowID(0),1,200,@FindDevice_Timer())
CreateThread(@Thread(),0)
Repeat
  Event=WaitWindowEvent()
  If Event=#PB_Event_Gadget
    Select EventGadget()
      Case 2
        SendDevice($AA00)
      Case 3
        SendDevice($5500)
    EndSelect
  EndIf
Until Event=#PB_Event_CloseWindow



DeviceInfo.pb
Code:
Procedure HID_DeviceInfo()
ClearGadgetItems(0)
Info.HID_Lib_DeviceInfo
If HID_Lib_DeviceInfo(@Info)
  If Info\CountDevice>0
    For i=0 To Info\CountDevice-1
      AddGadgetItem(0,i,Info\DeviceInfo[i]\Manufacturer)
      SetGadgetItemText(0,i,Info\DeviceInfo[i]\Product,1)
      SetGadgetItemText(0,i,Hex(Info\DeviceInfo[i]\ProductID,#PB_Word)+"H",2)
      SetGadgetItemText(0,i,Hex(Info\DeviceInfo[i]\VendorID,#PB_Word)+"H",3)
      SetGadgetItemText(0,i,Hex(Info\DeviceInfo[i]\VersionNumber,#PB_Word)+"H",4)
      SetGadgetItemText(0,i,Info\DeviceInfo[i]\SerialNumber,5)
      SetGadgetItemText(0,i,Str(Info\DeviceInfo[i]\NumInputBuffers),6)
      SetGadgetItemText(0,i,Str(Info\DeviceInfo[i]\InputReportByteLength),7)
      SetGadgetItemText(0,i,Str(Info\DeviceInfo[i]\OutputReportByteLength),8)
      SetGadgetItemText(0,i,Str(Info\DeviceInfo[i]\FeatureReportByteLength),9)
    Next i
  EndIf
EndIf
EndProcedure


OpenWindow(0,0,0,930,294,"USB HID devices info — HID_Lib  Demo",#PB_Window_MinimizeGadget|#PB_Window_Invisible|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
SmartWindowRefresh(0, 1)

ListIconGadget(0,2,2,924,290,"Manufacturer",100,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
   AddGadgetColumn(0,1,"Product",100)
   AddGadgetColumn(0,2,"PID",48)
   AddGadgetColumn(0,3,"VID",48)
   AddGadgetColumn(0,4,"Version #",90)
   AddGadgetColumn(0,5,"Serial #",104)
   AddGadgetColumn(0,6,"Input buffers number",110)
   AddGadgetColumn(0,7,"Input report size",120)
   AddGadgetColumn(0,8,"Output report size",124)
   AddGadgetColumn(0,9,"FEATURE",70)
HID_DeviceInfo()
HideWindow(0,0)

AddWindowTimer(0, 1, 400)

Repeat
   Event=WaitWindowEvent()
   If Event=#PB_Event_Timer
     If  EventTimer()=1
       HID_DeviceInfo()
     EndIf
     
   ElseIf Event=#PB_Event_SizeWindow
     ResizeGadget(0, #PB_Ignore, #PB_Ignore, WindowWidth(0)-4, WindowHeight(0)-4)
   EndIf
Until Event = #PB_Event_CloseWindow



DeviceTest.pb
Code:
#USB_PID=1
#USB_VID=$1234

Procedure Timer1()
If HID_Lib_DeviceTest(#USB_PID, #USB_VID)=1
  SetGadgetText(1,"Device is conected")
  SetGadgetColor(1,#PB_Gadget_FrontColor,$92616D)
Else
  SetGadgetText(1,"Device not found")
  SetGadgetColor(1,#PB_Gadget_FrontColor,$0000FF)
EndIf
EndProcedure
OpenWindow(0,0,0,280,100,"HID_Lib_DeviceTest",#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
TextGadget(0,40,10,200,16,"PID - "+Hex(#USB_PID)+"H;    VID - "+Hex(#USB_VID)+"H",#PB_Text_Center )
TextGadget(1,80,40,200,16,"")
Timer1()
AddWindowTimer(0, 1, 500)
Repeat
Event=WaitWindowEvent()
   If Event=#PB_Event_Timer
     If  EventTimer()=1
       Timer1()
     EndIf
   EndIf
Until Event = #PB_Event_CloseWindow


Top
 Profile  
 
 Post subject: Re: USB HID Library
PostPosted: Thu Aug 25, 2011 4:31 am 
Offline
User
User

Joined: Wed Aug 03, 2011 4:52 am
Posts: 98
Location: Beirut, Lebanon
Thanks a lot

_________________
PureBasic: Surprisingly simple, diabolically powerful


Top
 Profile  
 
 Post subject: Re: USB HID Library
PostPosted: Tue Oct 04, 2011 12:23 pm 
Offline
New User
New User

Joined: Tue Oct 04, 2011 12:04 pm
Posts: 1
Hi,
the HID Library looks great and i would like to use it! Unfortunately my avira antivir reports malware. Things like Rabbit.bcz, Rabbit.bda, Rabbit.bcy. Did anybody make the same experience? Can anybody give a proof that there is no malware inside or is the source code available?

thanks and best regards!


Top
 Profile  
 
 Post subject: Re: USB HID Library
PostPosted: Tue Oct 04, 2011 2:53 pm 
Offline
User
User

Joined: Sun Jun 15, 2008 3:13 am
Posts: 32
Location: Russia
fogmaster wrote:
...Unfortunately my avira antivir reports malware...
HID_Lib 4.51: http://www.virustotal.com/file-scan/rep ... 1317735830


Top
 Profile  
 
 Post subject: Re: USB HID Library
PostPosted: Thu Aug 02, 2012 12:57 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Aug 07, 2003 7:01 pm
Posts: 2853
Location: United Kingdom
Are you going to do a release of the lib for the latest x86 and x64 versions of PureBasic?

_________________
http://www.SinisterSoft.com <- My Business website
http://www.ReportComplete.com and http://www.ReportPlus.co.uk <- School end of term reports system


Top
 Profile  
 
 Post subject: Re: USB HID Library
PostPosted: Fri Aug 03, 2012 8:41 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Nov 12, 2008 5:01 pm
Posts: 239
Location: Russia
DoubleDutch wrote:
Are you going to do a release of the lib for the latest x86 and x64 versions of PureBasic?
Added to first post topics library for PureBasic 4.61 x64.

_________________
Library XP_Menu_Lib - office menu; HID_Lib - USB Library
Torrent client - pbTorrent (source code); Create driver in PureBasic.


Top
 Profile  
 
 Post subject: Re: USB HID Library
PostPosted: Fri Aug 03, 2012 11:12 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Aug 07, 2003 7:01 pm
Posts: 2853
Location: United Kingdom
Thanks. :)

_________________
http://www.SinisterSoft.com <- My Business website
http://www.ReportComplete.com and http://www.ReportPlus.co.uk <- School end of term reports system


Top
 Profile  
 
 Post subject: Re: USB HID Library
PostPosted: Sat Nov 10, 2012 9:55 pm 
Offline
New User
New User

Joined: Sat Nov 10, 2012 9:51 pm
Posts: 1
Thanks a lot :wink:


Top
 Profile  
 
 Post subject: Re: HID_Lib - Library
PostPosted: Fri May 24, 2013 8:23 pm 
Offline
New User
New User

Joined: Fri May 24, 2013 8:17 pm
Posts: 1
ColBoy wrote:
If I have a USB HID device, like a barcode scanner, does that mean I can read the code scanned directly using this library, or is there another hump that needs to be conquered?


yes! you can read the code scanned directly using the library very easily.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: Exabot [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye