Rename device with USBComposite library?

Working libraries, libraries being ported and related hardware
Post Reply
Kprellz
Posts: 17
Joined: Fri Jan 17, 2020 11:33 pm

Rename device with USBComposite library?

Post by Kprellz »

Hey all!
kind of silly but i'm wondering if its possible to change what name the computer sees when using the USBComposite class? as of right now i'm using the Midi portion of the library and it comes up as "maple" but im wondering if would be possible to make that custom? I thought I could simply change the name in the usb_generic.c but it hasnt worked for me.
Any help would be greatly appreciated!
Thanks!
MoDu
Posts: 16
Joined: Mon Jul 20, 2020 10:43 pm

Re: Rename device with USBComposite library?

Post by MoDu »

Easy peasy.

Code: Select all

const char ManufacturerName[] = "Kprellz";
const char DeviceName[] = "Device name";
const char DeviceSerial[] = "00000000000000000001";

USBComposite.setManufacturerString(ManufacturerName);
USBComposite.setProductString(DeviceName);
USBComposite.setSerialString(DeviceSerial);
USBComposite.setVendorId(VendorId);
USBComposite.setProductId(ProductId);
huseyinctlbs
Posts: 2
Joined: Thu Dec 03, 2020 6:14 pm

Re: Rename device with USBComposite library?

Post by huseyinctlbs »

Hello. I have tried this code but it doesn't work. The complier gives these errors;

'USBComposite' does not name a type USBComposite.setManufacturerString(ManufacturerName);
'USBComposite' does not name a type USBComposite.setProductString(DeviceName);
'USBComposite' does not name a type USBComposite.setSerialString(DeviceSerial);.

Im using 0.99 version. Am i getting these errors because of the version?
MoDu
Posts: 16
Joined: Mon Jul 20, 2020 10:43 pm

Re: Rename device with USBComposite library?

Post by MoDu »

Code: Select all

#include <USBComposite.h>
Just to be sure.

I use the latest version that's on github. I would suggest you do the same.

Edit: I just tried the 0.99 release (cf99055...) and it still works as expected on my project.
huseyinctlbs
Posts: 2
Joined: Thu Dec 03, 2020 6:14 pm

Re: Rename device with USBComposite library?

Post by huseyinctlbs »

I have tried in more than 10 different board but didn't get success. There must be something wrong in my setup. Am i have to delete driver of stm for seeing difference of name?

And im trying the name change for joystick. Is it different?


I have found solution after posting this. I have seperated the variables side and USBComposite sides then it complied. Maybe i have putting the code snippet wrong place in the complier before.

And there is my coplied code;

#include <USBComposite.h>
const char ManufacturerName[] = "xxx";
const char DeviceName[] = "yyyy";
const char DeviceSerial[] = "00000000000000000001";

USBHID HID;
HIDJoystick Joystick(HID);

void setup() {

USBComposite.setManufacturerString(ManufacturerName);
USBComposite.setProductString(DeviceName);
USBComposite.setSerialString(DeviceSerial);
USBComposite.setVendorId(0x987);

HID.begin(HID_JOYSTICK);
while (!USBComposite);
MoDu
Posts: 16
Joined: Mon Jul 20, 2020 10:43 pm

Re: Rename device with USBComposite library?

Post by MoDu »

See my working project for reference: https://github.com/GitMoDu/USB-x360-N64 ... roller.ino

What do you expect to see changed? I'm using only the xBox360 Controller end point, but all the details appear correct on the Driver Details on Windows.
Post Reply

Return to “Libraries & Hardware”