PB 6.30 b1 - HIDInfo()
-
- Addict
- Posts: 1554
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
PB 6.30 b1 - HIDInfo()
In MacOS function HIDInfo() with parameters #PB_HID_Product and #PB_HID_Manufacturer reads string in incorrect encoding. The USB descriptor contains unicode strings. But function HIDInfo() reads strings as ascii or utf8.
Re: PB 6.30 b1 - HIDInfo()
HIDAPI returns UTF-32 string which are converted in UTF-16 so it should work properly. Which characters are not converted as expected ? Can anybody else confirm with another device ?
Code: Select all
ExamineHIDs()
While NextHID()
Debug HIDInfo(#PB_HID_Product)
Debug HIDInfo(#PB_HID_Manufacturer)
Debug "****************"
Wend
Re: PB 6.30 b1 - HIDInfo()
Mac ARM
Code: Select all
; Debug HIDInfo(#PB_HID_Product)
; [COMPILER] Line 1: Constant not found: #PB_HID_Product.
ExamineHIDs()
While NextHID()
if HIDInfo(6)="Logitech"
Debug HIDInfo(7) ; Logitech Dual Action
Debug HIDInfo(8) ; 1
Debug HIDInfo(9) ; 4
EndIf
Wend
-
- Addict
- Posts: 1554
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: PB 6.30 b1 - HIDInfo()
Constants here viewtopic.php?p=644808#p644808
Re: PB 6.30 b1 - HIDInfo()
Thanks!

Code: Select all
; Also SEEMS to list disconnected devices (audio only?)
ExamineHIDs()
While NextHID()
Debug HIDInfo(6)
Debug HIDInfo(7)
Debug "---"
Wend
; Apple
; Headset
; ---
; Apple
;
; other Bluetooth devices SEEM to get listed only when connected (debug is longer):
; ---
;
; Pro Controller
-
- Addict
- Posts: 1554
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: PB 6.30 b1 - HIDInfo()
It's probably a bug hidapi library for macos.
I compared the result of this codewith result from hidapiAnd it is clear that there is a bug in hidapi.

On Windows and Linux, this problem does not exist.
I compared the result of this code
Code: Select all
ExamineHIDs(4660,2)
If NextHID()
s.s = HIDInfo(#PB_HID_Product)
ShowMemoryViewer(@s, StringByteLength(s))
EndIf
Code: Select all
ImportC #PB_Compiler_Home+"/purelibraries/macos/libraries/libpbhidapi.a"
hid_open(v,p,s)
hid_get_product_string(handle, *wstr, len)
EndImport
ExamineHIDs()
h = hid_open(4660,2,0)
*point = AllocateMemory(4096)
hid_get_product_string(h, *point, MemorySize(*point))
ShowMemoryViewer(*point, MemorySize(*point))

On Windows and Linux, this problem does not exist.