Bug: Kbd1 becomes Kbd2 , 3 , 4 etc

Announcements, general discussion
Post Reply
ZwuckeL
Posts: 5
Joined: 03 Feb 2012, 13:13

Bug: Kbd1 becomes Kbd2 , 3 , 4 etc

Post by ZwuckeL » 03 Feb 2012, 13:19

Hi

when ever i put new devices into my computer (im my example that is a iPod shuffle, an usb receiver for a wireless mouse and keyboard, a runners GPS clock) HID macros seems to mess up. all my macros break then.
this also happens when i pull those devices out again. so i can basically not use any usb devices on my computer without breaking the macros.

it seems when i put/pull other devices, the keyboards get new hardware Ids. Sometimes Kbd1 changes to Kbd2, Kbd2 to Kbd3, etc even though i just connected an ipod and no key board. Also sometime when i pull the ipod out it might change back to Kbd1 but then still doesnt work (it seems to get a different hardware id)

isnt there a way to define keyboards to be indentified as unique? help would be much appreciated.

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Bug: Kbd1 becomes Kbd2 , 3 , 4 etc

Post by admin » 06 Feb 2012, 08:42

I know this code is a little bit buggy, but I never found some reproducable case that I could analyze.
KbdX is sometimes renumbered and you lose connection with macros.
However there is a logic inHIDmacros that should link macros by device id.
So I recommend:
- name you devices, use different name then default Kbd1 etc. If you click on device in Device sheet you can rename it. Those custom names should not be swapped.
- if you know how to always reproduce this error, please let me know and I will check and fix it
Petr Medek
LUAmacros author

Vent
Posts: 3
Joined: 17 Jul 2012, 17:54

Re: Bug: Kbd1 becomes Kbd2 , 3 , 4 etc

Post by Vent » 17 Jul 2012, 18:16

Hi,

I have a similar problem with kbd1 sometimes becoming kbd2 etc.

I have a laptop and I plug in a USB keyboard where I have to remap some keys.

When I look at the devices list, the usb keyboard can get a different name assoicated with it's HID. If I name the keyboard it gets saved in the configuration file OK, however, if I unplug the keyboard, re-run HIDMacros, close HID macros and then look at the configuration file the named keyboard is gone.

So I think this would be easy to reproduce? Example (some macros already defined):

1. USB keyboard disconnected
2. Run HIDMacros
3. Close HIDMacros
4. Examine config xml

5. Plug in USB keyboard
6. Run HIDMacros
7. Close HIDMacros
8. Examine config xml - USB keyboard is detected and saved

9. Open HIDMacros
10. Rename USB Keyboard
11. Close HIDMacros
12. Examine config xml - USB keyboard is detected and renamed

13. Unplug USB keyboard
14. Run HIDMacros
15. USB Keyboard no longer in device list
16. Close HIDMacros
17. Examine config xml - Now no trace of USB keyboard

So I think the config file is getting rewritten completely every time HIDMacros is closed according to the current state of input devices, which means the devices are getting forgotten and so macros fail. Also the naming / ordering of kbd1/2 etc may change on reboot.

Perhaps what needs to happen is any renamed device (or have a button to always remember the device) should be permamently stored in the config file along with it's HID (along with some gui buttons to delete obsolete / unwanted devices) irrespective of if they are plugged in or not.

I think that would be similar to the way device manager works with it storing the details of every bit of hardware it comes across permamently so it knows what the device is if you happen to plug it in again.

Really hope that helps and thank you for this very useful software!

Best Regards,

Vent

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Bug: Kbd1 becomes Kbd2 , 3 , 4 etc

Post by admin » 18 Jul 2012, 07:31

Good points, thanks.
Probably I'll "touch" HIDmacros again soon implementing config file backups so this is another thing I'll check.
Petr Medek
LUAmacros author

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Bug: Kbd1 becomes Kbd2 , 3 , 4 etc

Post by admin » 11 Oct 2012, 22:55

Should be solved by 2.3 beta.
Download & test if you are interested.
Petr Medek
LUAmacros author

Vent
Posts: 3
Joined: 17 Jul 2012, 17:54

Re: Bug: Kbd1 becomes Kbd2 , 3 , 4 etc

Post by Vent » 01 Nov 2012, 17:34

Yup, 2.3 beta does fix it!

Thanks!

It doesn't work too well if there is no hidmacros.xml file though (access violation), have to end task from taskmanager to close it in that case. I copied the hidmacros.xml from the old version though and it worked fine since then. Will make a note about that on the 2.3 beta thread.

Best Regards,

Vent

Larry
Posts: 19
Joined: 28 Feb 2013, 06:45

Re: Bug: Kbd1 becomes Kbd2 , 3 , 4 etc

Post by Larry » 14 Mar 2013, 08:09

Hi,
I have a few questions kind of related (newbie). If a keyboard or keypad is disconnected from the computer, will all my macros be remembered when I plug it back in? :?: What if the computer is turned off with keyboard disconnected, then connected again after computer is turned on? :?: Will all the scripts/macros still be remembered? :?:

Also, I do not rename my keyboard/keypad devices (DEVICES-TAB/NAME) added to hidmacros anymore because if it's unplugged, then plugged back in, the new "device" name is gone and goes back to a default "kbd2" or "kdb3" etc. :x But the name is not always "kdb2" or "kdbd 3", it can be "kdbd 1". Will this cause all my work adding customs scripts and keyboard commands to be lost? :?: Is there any way to keep hidmacros from loosing the name when its disconnected? :?: Thank you! Larry

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Bug: Kbd1 becomes Kbd2 , 3 , 4 etc

Post by admin » 14 Mar 2013, 08:43

With 2.3 beta version you should never lose your macros as any not-detected keyboard found in xml configuration file is also displayed and you can easily transfer macros to different keyboard.
The keyboard is getting some internal identification which is also displayed at Devices tab. When the keyboard have the same identification, it should always have its macros linked after reload. If you unplug the keyboard, plug it back and windows assign different id (especially if you use different USB port) there's not much I can do to recognize this is the same keyboard.
I don't know all the rules, but you can play with it yourself as HIDmacros is showing assigned id.
So if you re-plug the keyboard, it gets different (default) name but the id is still the same, you found a bug that I can fix. If it gets different id... feel free to suggest a way how should HIDmacros recognize it is the keyboard.
Petr Medek
LUAmacros author

Larry
Posts: 19
Joined: 28 Feb 2013, 06:45

Re: Bug: Kbd1 becomes Kbd2 , 3 , 4 etc

Post by Larry » 17 Mar 2013, 06:29

Thanks for your reply. You answered my questions. great support here! Larry

Post Reply