USB HID 2 Channel Relay Needs Help
Publicado: 06 Ago 2021 06:58
Hi everyone how are you this days? Hoping you are good and fine away from covid..
Anyways i have found a 2 dll shared by @Pabloko on this thread: https://www.amsspecialist.com/viewtopic.php?f=15&t=7311
and first i tried the serial port using esp8266 however i have not luck to make it work in my test so i tried HID usb relay.
but still i cannot make send data to the device. Also wondering why the VID and PID is different form actual id of the device. i hope pabloko can help me this.. but if anyone have and idea i really appreciate the help.
some info of my hid is here:
https://github.com/pavel-a/usb-relay-hid
https://github.com/darrylb123/usbrelay
here are the things:
using the provide link of pabloko for the HID i tried to enumerate and display all hid devices..
Code on show:
table = HID.Enumerate(0) --use 0 for wildcard
_hid = Table.Count(table);
for i=1, _hid do
result = ComboBox.AddItem("ComboBox1", table.manufacturer_string.." "..table.product_string.." - (VID:"..table.vid.. ") (PID:"..table.pid..")", i);
end


as you can see the vid from table.vid is different form the vid in the path..
on ComboBox1 code:
dev = ComboBox.GetSelected(this);
index = String.ToNumber(ComboBox.GetItemData(this, dev));
vid = table[index].vid
pid = table[index].pid
path = table[index].path
serial = table[index].serial
release_number = table[index].release_number
manufacturer_string = table[index].manufacturer_string
product_string = table[index].product_string
interface_number = table[index].interface_number
--device = HID.Open(vid,pid,serial)
device = HID.OpenPath(path)
--result = Dialog.Message("Notice", tostring(device), MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Input.SetText("Input1", path)
Input.SetText("Input2", tostring(device))
xButton:
device = HID.Open(vid, pid, 0)
device = HID.OpenPath(path)
written=HID.Write(device, "ON1") --data is a literal string
i cannot send data to my hid because device = HID.Open(vid, pid, 0) will result nil value...
hope anyone can help.. thank you.
Anyways i have found a 2 dll shared by @Pabloko on this thread: https://www.amsspecialist.com/viewtopic.php?f=15&t=7311
and first i tried the serial port using esp8266 however i have not luck to make it work in my test so i tried HID usb relay.
but still i cannot make send data to the device. Also wondering why the VID and PID is different form actual id of the device. i hope pabloko can help me this.. but if anyone have and idea i really appreciate the help.
some info of my hid is here:
https://github.com/pavel-a/usb-relay-hid
https://github.com/darrylb123/usbrelay
here are the things:
using the provide link of pabloko for the HID i tried to enumerate and display all hid devices..
Code on show:
table = HID.Enumerate(0) --use 0 for wildcard
_hid = Table.Count(table);
for i=1, _hid do
result = ComboBox.AddItem("ComboBox1", table.manufacturer_string.." "..table.product_string.." - (VID:"..table.vid.. ") (PID:"..table.pid..")", i);
end


as you can see the vid from table.vid is different form the vid in the path..
on ComboBox1 code:
dev = ComboBox.GetSelected(this);
index = String.ToNumber(ComboBox.GetItemData(this, dev));
vid = table[index].vid
pid = table[index].pid
path = table[index].path
serial = table[index].serial
release_number = table[index].release_number
manufacturer_string = table[index].manufacturer_string
product_string = table[index].product_string
interface_number = table[index].interface_number
--device = HID.Open(vid,pid,serial)
device = HID.OpenPath(path)
--result = Dialog.Message("Notice", tostring(device), MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Input.SetText("Input1", path)
Input.SetText("Input2", tostring(device))
xButton:
device = HID.Open(vid, pid, 0)
device = HID.OpenPath(path)
written=HID.Write(device, "ON1") --data is a literal string
i cannot send data to my hid because device = HID.Open(vid, pid, 0) will result nil value...
hope anyone can help.. thank you.