PureBasic 6.30 beta 1 - OpenHID() parameter SerialNumber

Post bugreports for the Windows version here
User_Russian
Addict
Addict
Posts: 1528
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

PureBasic 6.30 beta 1 - OpenHID() parameter SerialNumber

Post by User_Russian »

Tested this code in Windows x64.

If in function OpenHID() add optional parameter "SerialNumber"

Code: Select all

x=OpenHID(0, $1234, $1, 2)
the application crashes
[ERROR] Invalid memory access. (read error at address 2)
If pass a pointer to a variable, there is no crash, but the device is not found.

I also noticed that the HID library is missing a function HidID() (similar FileID(), WindowID() etc.).
infratec
Always Here
Always Here
Posts: 7616
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: PureBasic 6.30 beta 1 - OpenHID() parameter SerialNumber

Post by infratec »

An USB SerialNumber is a string. (like AARRNIBB9X3FZKXI)
This works without error:

Code: Select all

OpenHID(0, 1234, 456, @"123")
But it looks like a bug, I don't think that this is the intention.
Last edited by infratec on Wed Sep 03, 2025 8:56 pm, edited 2 times in total.
User_Russian
Addict
Addict
Posts: 1528
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: PureBasic 6.30 beta 1 - OpenHID() parameter SerialNumber

Post by User_Russian »

Probably not a string.

Code: Select all

x=OpenHID(0, $1234, $1, "2")

Code: Select all

---------------------------
PureBasic
---------------------------
Line 1: Bad parameter type, number expected instead of string.

Code: Select all

x=OpenHID(0, $1234, $1, @"2")

Code: Select all

Device with requested VID/PID/(SerialNumber) not found
User_Russian
Addict
Addict
Posts: 1528
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: PureBasic 6.30 beta 1 - OpenHID() parameter SerialNumber

Post by User_Russian »

Figured it out. Really need to pass a string - result form HIDInfo(#PB_HID_SerialNumber).
Post Reply