ArduinoJoystickLibrary icon indicating copy to clipboard operation
ArduinoJoystickLibrary copied to clipboard

is it possible to Rename the HID Controller

Open flow1986 opened this issue 8 years ago • 31 comments

Hi, i´d like to connect 4 Arduino-gamepads to my PC and my Raspberrry. is it possible to change the HID name? so that i don´t have: arduino leonardo arduino leonardo arduino leonardo arduino leonardo

but my own names?

flow1986 avatar Aug 12 '16 18:08 flow1986

I have not been able to figure out how to do this yet, but it seems like it should be possible. I am leaving this issue open as a future enhancement. If anyone knows how to do this, let me know.

MHeironimus avatar Sep 05 '16 12:09 MHeironimus

At one time I tought that recompiling boot loader would be enough: http://forum.arduino.cc/index.php?topic=249011.0

But apparently not: http://forum.arduino.cc/index.php?topic=275686.0

However I never tried to do it myself.

ytmytm avatar Sep 05 '16 12:09 ytmytm

Have you tried to change the string in HID.h or HID.cpp ? I think i saw something like this somewhere in the Arduino IDE base libraries..

marekhalmo avatar Sep 08 '16 11:09 marekhalmo

I found some steps for changing the name, courtesy of this YouTube video: https://www.youtube.com/watch?v=nrT7WXFEEZI

  1. Go to control panel.
  2. Open 'Devices and Printers'.
  3. Find your controller , right click ~ properties.
  4. Go to tab 'Hardware' , and open properties on HID-compliant...
  5. Go to tab 'Details' and select on 'Property' ~ Hardware Ids.
  6. Remember your value , VID_045E&PID_02A1 " Every controller has different value. "
  7. Go to start , and open regedit.exe.
  8. Go to : A. HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM\VID_045E&PID_02A1 B. HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\MediaProperties\PrivateProperties\Joystick\OEM\VID_045E&PID_02A1
  9. Change OEM Name to your preferences.
  10. Done!

However, this changes the name for ALL "Arduino Leonardo" devices. I'm not sure how to change the name for just one specifically. The joystick devices seem to identify to windows based on VID and PID. If there were some way to safely change these, it might be possible to name them individually.

However, based on some of my previous experiments, extreme care must be taken here. If you change the VID or PID of the hardware Leonardo, you run the risk of the Arduino IDE not recognizing it for sketch uploads anymore. There might be a way to modify it for just the joystick device, but I don't know enough about HID to say. Hopefully @MHeironimus or someone else with more talent than me can use this as a starting point.

trevorirwin avatar Sep 19 '16 17:09 trevorirwin

Unfortunately I couldn’t figure out how it can be influenced from within the sketch. But you can change the name globally by modifying the “boards.txt” file.

This will modify the name for all devices programmed. So if you want to have Name A, B and C for your devices you need to change the “boards.txt” to “A”, program the A device, then change the boards.txt to “B” then program the B device etc.

The boards.txt can be found in the Arduino installation folder, for instance: C:\Program Files (x86)\Arduino\hardware\arduino\avr\boards.txt

In case you’re device is reported as "Arduino Micro", then you need to change the “Arduino Micro” entry , in case its an Arduino Leonardo then change the appropriate usb_product entry.

For instance to change a Arduino Leonardo rename the entry: micro.build.usb_product="Arduino Leonardo" to micro.build.usb_product="LuckyB's Joystick"

Result: image

bjoernboeckle avatar Nov 29 '16 10:11 bjoernboeckle

@bjoernboeckle Thank you for posting your findings.

MHeironimus avatar Nov 29 '16 11:11 MHeironimus

Hi,

Thanks for the Tip with the Product Name change. It was working perfectly for me also. However, the 3 Joysticks itself are still named Arduino Leonardo. Please refer to attached Pictures.

Therefore i'm still struggeling within my Flight Simulator to find correct Joystick, as i have connected 3 Leonardo Boards with 3 Joysticks each. Within Game, they are all named "Arduino Leonardo" :-)

productname

joysticks

maxx8888 avatar Jan 01 '17 16:01 maxx8888

You are legally not allowed to change the name and use Arduino LLCs USB Vendor Id,. So you have to buy a Vendor Id yourself, which costs $5.000: http://www.usb.org/developers/vendor/ I don't think it's an issue if you don't want to sell / release your product, though.

Here's an article about Vendor Ids for open source projects: https://www.oshwa.org/2013/11/19/new-faq-on-usb-vendor-id-and-product-id/ And here is a site that gives away pids for open source projects: http://pid.codes/

Anyway, i just found a hack to solve this issue WITHOUT having to recompile the boot loader (which is what most people say you need to do)

In the boards.txt change the usb_product and the vendor / product id. e.G.

leonardo.build.vid=0x9999 leonardo.build.pid=0x9999 leonardo.build.usb_product="My Awesome Controller Leonardo"

If your device, is the first device connected to this computer with that vid / pid combination, it will be displayed with your usb_product name. (vid, pid, and product name are cached in the registry, so if the product that uses this vid / pid legally will later be connected to the same computer, it will also show your name.) Note: If you use an id that is already used by another device, windows might tries to install the wrong driver.

It only shows "Arduino Leonardo" in the Game Controller Window, because you had an Arduino Leonardo connected to your computer before. On fresh installs, it would work without the vid/pid change, but it will show every Leonardo with your name then.

Dak0r avatar Mar 04 '17 22:03 Dak0r

@Dakor91 - Thank you for posting your findings.

MHeironimus avatar Mar 05 '17 14:03 MHeironimus

@Dakor91 Thank you very much for that info! It solved my problem.

silveirago avatar Jul 17 '17 00:07 silveirago

@Dakor91 Thanks for that! While the solution I posted earlier worked for renaming a single class of device, your solution is so much better because it allows my devices to identify differently to a single PC.

trevorirwin avatar Aug 01 '17 03:08 trevorirwin

When I do as @Dakor91 suggested it shows up with the new name in the devices page in the new windows 10 settings but no longer gets recognized as a game controller for some reason... Any ideas?

Edit: it seems switching back to the default constructor instead of a custom wheel based one works. Gonna play around and see if I can narrow the issue down a bit.

Edit 2: The arguments passed to the constructor don't really actually seem to line up correctly with what you've listed in the readme. The X, Y, Z, options seemed to remove RX, RY, RZ instead. What you have as throttle appears as the Y axis on the steering joystick and is marked as the accelerator and enabling the accelerator actually shows a throttle slider. Disabling steering with just throttle and brake enabled for some reason shows the steering/accelerator joystick and rudder. Definitely something off with either your documentation or the implementation @MHeironimus.

JamesCoyle avatar Sep 28 '17 00:09 JamesCoyle

If I change the VID and PID it does not show up in Game Controllers in windows. It Shows up as a HID-compliant device and USB Input Device in device manager and under other devices it shows up as a serial device with no drivers. If I force the arduino drivers on the serial device it will work as a serial device but it still doesn't show up in Game Controllers. Any ideas how to fix this? I can have 2 different names if I change the PID to leonardos PID on one and the micro on another, but if i want more unique names changing the PID to a random value would be nice.

condac avatar Mar 31 '18 22:03 condac

There is a bug somehow. I uploaded an example to a new adruino with new random VID and PID and it works. So if i change the VID and upload my code first, my code does not work. But when I load it with an example and plug it in then i can reload it with my code and it works. Some how having this joystick initializer does not work ( the example for driving controller): Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID, JOYSTICK_TYPE_MULTI_AXIS, 4, 0, false, false, false, false, false, false, false, false, true, true, true); But if i change it to the example for gamepad it works fine. Or if i have used the gamepad example before on that VID it starts to work.

condac avatar Mar 31 '18 22:03 condac

Hello, Sorry for the up but did anyone find a way to change the HID name of a single (or two) controller on a same Arduino ? I'm currently working on a project and that would be very helpful if there was a way to use only one board instead of two

tseiracq avatar Jun 11 '19 13:06 tseiracq

Hello, Sorry for the up but did anyone find a way to change the HID name of a single (or two) controller on a same Arduino ? I'm currently working on a project and that would be very helpful if there was a way to use only one board instead of two

I've been searching for quite a long time and not found any way to change individual controllers under the same device :( you can change the name of the HID with borads.txt but individual controllers will all have same name you used.

alijani1 avatar May 17 '20 06:05 alijani1

it does not work at all

phil123456 avatar Jan 20 '21 14:01 phil123456

There is a demonstration on how to do this towards the end of this video: Arduino Joystick 2.0 Library - Beginners Guide.

MHeironimus avatar Jan 24 '21 18:01 MHeironimus

Thanks for the info, I was looking for it :-) I'll try!

jormc avatar Mar 05 '21 08:03 jormc

There is a demonstration on how to do this towards the end of this video: Arduino Joystick 2.0 Library - Beginners Guide.

Thanks for the tip, I wasn't able to add additional avr boards.txt file as described in video, but i achived goal by appending new board config with tweaks described in video to the end of default (placed AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.4) boards.txt file. So now my config shows up in board list, and after flash it changes HID name image image

Shchava avatar Dec 25 '21 23:12 Shchava

Hi, ive been having this very same naming issue for....months, i have 5 button boxes for my sim rig which i bought from an ebay seller , they all use Arduino Leonardo boards....or so i thought, after opening up one of the boxes i found that they are Pro Micro boards and not official Arduino.

After many attempts at trying different things... like using the Musinou board txt file i found out that as well as using the board txt files you also need to upload a a sketch at the same time, in my case i used a 32-FUNCTION-BUTTON-BOX-master sketch from AMSTUDIO.

Although i had several hurdles to get over... getting the correct keyboard library, finding the correct location of the board txt file for editing....Windows11 seems to block access to the Arduino IDE app location....nice one MS and much more fiddling.

So now everything is in place, i change the leonardo.build.usb_product= name to my chosen name and the sketch i acquired ....upload and voila, shows up in device and printers under controllers but after clicking properties it still showed as Arduino leonardo, i tested the board running Asseto corsa and BAM....Leonardo device detected.

Now for the fix, the vid and PID codes have to be changed from the original but also they must not clash with any other usb devices, unless you have a complete list of your device ids....this seems to be pot luck, I have not tested the same new code with my other boxes but as precaution im using different code for each box, it means editing the board txt file 5 times but it does mean my games detect different devices instead of multiple Arduino Leonardos.

Licensing issues, all my boards are Arduino compatibles made by SparkFun, they state on there website that the user is free to change the name of there boards and does not require a license to do so.

I have tested this method with Asseto corsa and American truck sim and both games detect my board as the name given.

This process can be hit and miss, i suggest testing on a board thats new and unwired to a device, In my endeavor... I broke one button box by accidentally breaking off the usb socket from the Pro Micro and killed another by trying to jump the onboard reset/gnd after a bad upload.

racdavies avatar Dec 29 '21 12:12 racdavies

you can add several defines to a new submenu https://gist.github.com/Hyratel/80017369fedd1bbc9eef4c8e7a896225

Hyratel avatar Mar 24 '22 18:03 Hyratel

Hi, ive been having this very same naming issue for....months, i have 5 button boxes for my sim rig which i bought from an ebay seller , they all use Arduino Leonardo boards....or so i thought, after opening up one of the boxes i found that they are Pro Micro boards and not official Arduino.

After many attempts at trying different things... like using the Musinou board txt file i found out that as well as using the board txt files you also need to upload a a sketch at the same time, in my case i used a 32-FUNCTION-BUTTON-BOX-master sketch from AMSTUDIO.

Although i had several hurdles to get over... getting the correct keyboard library, finding the correct location of the board txt file for editing....Windows11 seems to block access to the Arduino IDE app location....nice one MS and much more fiddling.

So now everything is in place, i change the leonardo.build.usb_product= name to my chosen name and the sketch i acquired ....upload and voila, shows up in device and printers under controllers but after clicking properties it still showed as Arduino leonardo, i tested the board running Asseto corsa and BAM....Leonardo device detected.

Now for the fix, the vid and PID codes have to be changed from the original but also they must not clash with any other usb devices, unless you have a complete list of your device ids....this seems to be pot luck, I have not tested the same new code with my other boxes but as precaution im using different code for each box, it means editing the board txt file 5 times but it does mean my games detect different devices instead of multiple Arduino Leonardos.

Licensing issues, all my boards are Arduino compatibles made by SparkFun, they state on there website that the user is free to change the name of there boards and does not require a license to do so.

I have tested this method with Asseto corsa and American truck sim and both games detect my board as the name given.

This process can be hit and miss, i suggest testing on a board thats new and unwired to a device, In my endeavor... I broke one button box by accidentally breaking off the usb socket from the Pro Micro and killed another by trying to jump the onboard reset/gnd after a bad upload.

Hi, I actually managed to sort it out shortly after posting here, my main issue was trying to update using IDE without adding a sketch, the guy i bought the boxes off sent me new sketch's for all 5 boxes as they all have different matrix`s, now all i need is about an extra 5 hours a day to have time to actually use my sims.... either that or win the lottery lol

racdavies avatar Mar 24 '22 19:03 racdavies

@MHeironimus https://github.com/abratchik/HIDPowerDevice https://github.com/arduino/ArduinoCore-avr/pull/387

this might be something we can work with :) i think it would be realy awesome to support custom hid names

vospascal avatar May 17 '22 17:05 vospascal

@MHeironimus https://github.com/Hyratel/LeonardoPIDboards have a looky here. I went through and spun this up. you have to use different PIDs because windows Caches the name in the registry. (the 0x5000 range on PID.codes is fairly empty so I feel fairly safe using it. it's not... great because it collides with 1 or 2 already listed, but at the time I just did not have the patience to look for 50 consecutive unused values)

Hyratel avatar May 17 '22 17:05 Hyratel

@MHeironimus https://github.com/Hyratel/LeonardoPIDboards have a looky here. I went through and spun this up. you have to use different PIDs because windows Caches the name in the registry. (the 0x5000 range on PID.codes is fairly empty so I feel fairly safe using it. it's not... great because it collides with 1 or 2 already listed, but at the time I just did not have the patience to look for 50 consecutive unused values)

I think this only works on the pc where it’s uploaded not if you plug in something else right

vospascal avatar May 17 '22 19:05 vospascal

@vospascal no, it loads the names into the USB stack on the arduino, so it will announce itself with the name you set. it will work on any machine that way. the Cacheing is when windows recieves a USB announce, it loads that into the registry and any changes in device name will not be reflected because it's pulling the names from cache not device

Hyratel avatar May 17 '22 20:05 Hyratel

yea i know the methode but its not realy same as setting names vendor in the hid report

vospascal avatar May 18 '22 17:05 vospascal

Hello, Any help for doing this for an Arduino DUE? It works for my Micro Pro (F14 HCU), but not my Arduino DUE (F14 Button Box). Thanks a lot!

(Screen : https://media.discordapp.net/attachments/349553308949544964/1043537031843815454/image.png )

Clemy01 avatar Nov 19 '22 14:11 Clemy01

You are legally not allowed to change the name and use Arduino LLCs USB Vendor Id,. So you have to buy a Vendor Id yourself, which costs $5.000:

There is nothing about legality of using your own unregistered vendor ids. It could annoy the USB committee but there is no crime they can charge you with for using an unregistered vendor ID. Though keep in mind you can falsely trigger different drivers on your computer if you have a conflict but there is no legal or civil actions against you if you choose to change these values. They could get you for trademark/copyright if you use their logos and trademarks without paying a license... but if you take an off the self USB host device and change the ID values for your own convenience they can't do anything about it.

mwwhited avatar Mar 14 '23 13:03 mwwhited