I tried to reproduce the problem writing an example for any wacom raw data tester for you, and I could not reproduce the problem.
The other program uses the new screen gui, this one is not. There is a good chance, that this is a user error of mine, so please mods,
move this to generic or coding questions until further examination.
Because I wrote it, I put here the wacom tester. No parse, just raw data display, but does not produce the problem.
Code: Select all
;PB 6.30 beta 6
;wacom digitalizer/stylus raw HID test
DeclareModule petskii
EnableExplicit
;=======================================================================
;system font
;=======================================================================
Declare LoadSyStemFont()
Declare text(x,y,text.s,color.i,intensity.i=255)
Declare centertext(x,y,text.s,color.i,intensity.i=255)
Declare FreeSyStemFont()
EndDeclareModule
Module petskii
;======================================================
;System fonts for displaying system messages on screen
;======================================================
#USED_CHARACTERS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+[{]};:',<.>/?"+Chr(34)
Global Dim font(370):Global Dim fontimport.i(370)
Procedure LoadSyStemFont()
Protected x.i,i.i,j.i,sprline.a
For i = 1 To Len(#USED_CHARACTERS):fontImport(Asc(Mid(#USED_CHARACTERS,i,1)))=1 : Next i
Restore sysfont
For x= 1 To 370
If fontimport(x)=1
font(x)=CreateSprite(-1,8,12,#PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(font(x)))
DrawingMode(#PB_2DDrawing_AllChannels)
For j=0 To 11
Read.a sprline
For i=0 To 7
If sprline&%1 :Plot(i,j,RGBA(255,255,255,255)): Else : Plot(i,j,RGBA(0,0,0,0)) : EndIf
sprline>>1
Next i
Next j
StopDrawing()
ZoomSprite(font(x),16,24)
EndIf
Next x
EndProcedure
Procedure text(x,y,text.s,color.i,intensity.i=255) : Protected.i textlength,i,character
textlength.i = Len(text.s)
For i = 1 To textlength.i
character.i = Asc(Mid(text.s,i,1))
If character.i>ArraySize(font()) : ProcedureReturn #Null : EndIf
If IsSprite(font(character))
DisplayTransparentSprite(font(character),(x+((i-1) * 16)),(y),intensity,color.i)
EndIf
Next i
EndProcedure
Procedure centertext(x,y,text.s,color.i,intensity=255)
Protected textlength.i
textlength.i = Len(text.s)
x=x-(textlength*8) : y=y-8
text(x,y,text.s,color,intensity)
EndProcedure
Procedure FreeSyStemFont()
Protected i.i
For i = 1 To Len(#USED_CHARACTERS)
If IsSprite(font(i)) : FreeSprite(font(i)) : EndIf
Next i
EndProcedure
DataSection
sysfont:
Data.q $3838383838380000,$EEEE000000003800,$00000000000000EE,$FFEEFFEEEEEE0000,$383800000000EEEE,$0000387EE07C0EFC,$1C3870EECECE0000,$7C7C00000000E6EE,$0000FCEEEE3C7CEE
Data.q $00003870E0E00000,$7070000000000000,$000070381C1C1C38,$707070381C1C0000,$0000000000001C38,$000000EE7CFF7CEE,$38FE383800000000,$0000000000000038,$001C383800000000
Data.q $00FE000000000000,$0000000000000000,$0000383800000000,$3870E0C000000000,$7C7C000000000E1C,$00007CEEEEFEFEEE,$38383C3838380000,$7C7C00000000FE38,$0000FE0E1C70E0EE
Data.q $E078E0EE7C7C0000,$E0E0000000007CEE,$0000E0E0FEEEF8F0,$E0E07E0EFEFE0000,$7C7C000000007CEE,$00007CEEEE7E0EEE,$383870EEFEFE0000,$7C7C000000003838,$00007CEEEE7CEEEE
Data.q $E0FCEEEE7C7C0000,$3838000000007CEE,$0000383800000038,$0000003838380000,$F0F00000001C3838,$0000F0381C0E1C38,$FE00FE0000000000,$1E1E000000000000,$00001E3870E07038
Data.q $3870E0EE7C7C0000,$7C7C000000003800,$00007CCE0EFEFEEE,$EEFEEE7C38380000,$7E7E00000000EEEE,$00007EEEEE7EEEEE,$0E0E0EEE7C7C0000,$3E3E000000007CEE,$00003E7EEEEEEE7E
Data.q $0E3E0E0EFEFE0000,$FEFE00000000FE0E,$00000E0E0E3E0E0E,$EEFE0EEE7C7C0000,$EEEE000000007CEE,$0000EEEEEEFEEEEE,$383838387C7C0000,$F8F8000000007C38,$00003C7E70707070
Data.q $3E1E3E7EEEEE0000,$0E0E00000000EE7E,$0000FE0E0E0E0E0E,$CEFEFEFECECE0000,$EEEE00000000CECE,$0000EEEEFEFEFEFE,$EEEEEEEE7C7C0000,$7E7E000000007CEE,$00000E0E0E7EEEEE
Data.q $EEEEEEEE7C7C0000,$7E7E00000000F07C,$0000EE7E3E7EEEEE,$E07C0EEE7C7C0000,$FEFE000000007CEE,$0000383838383838,$EEEEEEEEEEEE0000,$EEEE000000007CEE,$0000387CEEEEEEEE
Data.q $FEFECECECECE0000,$EEEE00000000CEFE,$0000EEEE7C387CEE,$387CEEEEEEEE0000,$FEFE000000003838,$0000FE0E1C3870E0,$1C1C1C1C7C7C0000,$7C7C000000007C1C,$00007C7070707070
Data.q $3838FE7C38380000,$0000000000003838,$0000FF0000000000,$FCE07C0000000000,$000000000000FCEE,$00007EEEEE7E0E0E,$0E0E7C0000000000,$0000000000007C0E,$0000FCEEEEFCE0E0
Data.q $FEEE7C0000000000,$0000000000007C0E,$0000383838FC38F0,$EEEEFC0000000000,$0E0E0000007EE0FC,$0000EEEEEEEE7E0E,$38383C0038380000,$0000000000007C38,$003C707070700070
Data.q $3E7E0E0E0E0E0000,$3C3C00000000EE7E,$00007C3838383838,$FEFEEE0000000000,$000000000000CEFE,$0000EEEEEEEE7E00,$EEEE7C0000000000,$0000000000007CEE,$000E0E7EEEEE7E00
Data.q $EEEEFC0000000000,$0000000000E0E0FC,$00000E0E0EEE7E00,$7C0EFC0000000000,$0000000000007EE0,$0000F0383838FE38,$EEEEEE0000000000,$000000000000FCEE,$0000387CEEEEEE00
Data.q $FEFECE0000000000,$000000000000FCFC,$0000EE7C387CEE00,$EEEEEE0000000000,$00000000003E70FC,$0000FE1C3870FE00,$381E3838F0F00000,$1E1E00000000F038,$00001E3838F03838
EndDataSection
;=======================================================================
EndModule
EnableExplicit
Structure hstruct
id.i
iswacom.i
path.s
vid.s
pid.s
*buffer
lastsize.i
EndStructure
Global Dim devices.hstruct(255)
Global Dim wacomdevices.hstruct(255)
;counters
Global a.i, wacomcount.i, i.i, j.i
Global startpolling.a = #False
Global mbutton.a = #False
Global color.i
Global sd.s ;string data to display from the buffer
;-====PROGRAM START====
InitSprite():InitKeyboard():InitMouse()
ExamineDesktops()
OpenWindow(0, 0,0, DesktopWidth(0)*0.8,DesktopHeight(0)*0.8, "Test",#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, WindowWidth(0), WindowHeight(0), 0, 0, 0)
petskii::LoadSyStemFont()
ExamineHIDs()
While NextHID()
a+1
devices(a)\vid = RSet(Hex(Val(HIDInfo(#PB_HID_VendorId))), 4, "0")
devices(a)\pid = RSet(Hex(Val(HIDInfo(#PB_HID_ProductId))), 4, "0")
devices(a)\path = HIDInfo(#PB_HID_Path)
;If wacom, open with hidpath, this includes any virtualHID interface created by Wacom drivers, usually pid:1001
;There is no problem yet, it would work. Proble starts when you start to poll or sampling the raw hid data.
If devices(a)\vid = "056A"
wacomcount+1
OpenHIDPath(a,devices(a)\path)
devices(a)\iswacom = #True
wacomdevices(wacomcount)\buffer = AllocateMemory(4096)
wacomdevices(wacomcount)\id = a
EndIf
Wend
Repeat
While WindowEvent():Wend
ClearScreen(0)
ExamineKeyboard()
ExamineMouse()
MouseDeltaX()
If MouseButton(#PB_MouseButton_Right)
If mbutton<>#True : startpolling = 1-startpolling : mbutton = 1-mbutton : EndIf
Else
mbutton = 0
EndIf
If startpolling
If wacomcount = 0
petskii::centertext(ScreenWidth()/2,50,"No wacom devices/virtual devices present.",$0000FF)
Else
petskii::centertext(ScreenWidth()/2,50,Str(wacomcount)+ " wacom devices/virtual interface present.",$00FF00)
;-try to read data from all interfaces, the problem occours even if only one is open and used
For i = 1 To wacomcount
If IsHID(wacomdevices(i)\id)
wacomdevices(i)\lastsize = ReadHIDData(wacomdevices(i)\id,wacomdevices(i)\buffer,4096,10)
;displays the first 10 bytes of received data, green in color, if receivedsize<>0, red otherwise
;Colors are in bgr, here that works
If wacomdevices(i)\lastsize = 0 : color.i = $0000FF : Else : color.i = $00FF00 : EndIf
sd.s = "" ; string data to display
For j= 0 To 9
sd.s = sd.s + RSet(Hex(PeekA(wacomdevices(i)\buffer+j)),2,"0")
Next j
petskii::text(10,100+(i*35),"[Entry: "+RSet(Str(i),2,"0")+"]: "+sd,color)
Else
color.i = $0000FF
petskii::text(10,100+(i*35),"[Entry: "+RSet(Str(i),2,"0")+"]: not Open ",color)
EndIf
Next i
EndIf
EndIf
petskii::centertext(ScreenWidth()/2,10,"Press Right mouse to start/stop reading HID data",$FFFFFF)
If startpolling : petskii::centertext(ScreenWidth()/2,30,"Polling data",$FFFFFF) : EndIf
petskii::text(MouseX(),MouseY(),"mcursor",$FFFFFF)
FlipBuffers()
Until KeyboardReleased(#PB_Key_Escape) Or MouseButton(3)
If wacomcount>0
For i = 1 To wacomcount
CloseHID(wacomdevices(i)\id)
FreeMemory(wacomdevices(i)\buffer)
Next i
EndIf