CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to change USB device name ?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
spilz



Joined: 30 Jan 2012
Posts: 216

View user's profile Send private message

How to change USB device name ?
PostPosted: Sat Mar 13, 2021 3:51 pm     Reply with quote

Hello

To start, I already try to find the answer but finally never find it in all subjects about it.

I want to change the name of the device in "device manager" of WIN10.

I tried to USB_STRING_DESC[] but the name appear in wizard installation but then never find a way to get it again. (That was explain in some USB files).

So if I understand well the name in "device manager" comes from driver.

I tried to change the name in "cdc_NTXPVista_7_8_10.inf".

CCS_CDC2 = "CCS USB to UART" to CCS_CDC2 = "CCS USB to UART 2"

For test, but driver seems to be changed by default Windows driver after the change :(

Do I understand well that the solution to change the name is in driver ?

How can I change the driver for this ?

Thanks for your help
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Sun Mar 14, 2021 4:30 am     Reply with quote

Multiple parts to this.

Windows 10, will now only run 'registered' drivers. When you tried
to change the name in the driver, it said 'not registered', and puts back the
standard driver. To actually change this like this, you would have to have a
registered driver for your device... Sad
The full driver as well as the .inf file, has to have a matching .cat file.
There are tools to build this, but you are talking having to use the full
driver development kit.

However, you can change the device 'name' that is associated with a
specific driver. This thread shows how:
https://www.avoiderrors.com/rename-devices-device-manager/

This is probably by far the easiest way to do this. Remember also that
you can export this registry entry and have this added as part of your install
to support the new name on other machines.
spilz



Joined: 30 Jan 2012
Posts: 216

View user's profile Send private message

PostPosted: Sun Mar 14, 2021 4:40 am     Reply with quote

Thanks for your reply Ttelmah

So if I understand well USB_STRING_DESC[] is no more really used by Win10 :(

With the .inf can i directly build a .cat (what ever how) ?
or other files are needed ?

My goal was to change the name of serial port to make difference between devices and so a software in C# will directly identify the right device and run a specific program
What I understand, it’s no more possible. Right ?
If they use the same driver they will have the same name, aren’t they ?

No other magic solution for my need ? ^^

Thanks again
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Sun Mar 14, 2021 7:33 am     Reply with quote

It is used, to identify which driver to load. Problem is if you change this,
you have to have a matching driver, and the driver now needs to be a
'signed' type. You can't just create your own .inf file as you used to.

It is actually 'possible' to put in a unsigned driver still, but a lot of work:

https://www.howtogeek.com/167723/how-to-disable-driver-signature-verification-on-64-bit-windows-8.1-so-that-you-can-install-unsigned-drivers/
and (of course) will be have to done on every machine where you use
the device....
spilz



Joined: 30 Jan 2012
Posts: 216

View user's profile Send private message

PostPosted: Sun Mar 14, 2021 7:43 am     Reply with quote

Ok :(

No other way to make difference between 2 devices which use same driver ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Sun Mar 14, 2021 11:05 am     Reply with quote

If you give the devices a unique serial number, then the name allocation
(done by the method shown), will be permanently assigned to the specific
device.
You have to assign a new string descriptor for the serial number. It is
normally blank.
spilz



Joined: 30 Jan 2012
Posts: 216

View user's profile Send private message

PostPosted: Sun Mar 14, 2021 3:29 pm     Reply with quote

Which method ?

Where can I change the serial number ? In CCS ? What is the name of variable ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19215

View user's profile Send private message

PostPosted: Mon Mar 15, 2021 12:24 am     Reply with quote

Quote:

However, you can change the device 'name' that is associated with a
specific driver. This thread shows how:
https://www.avoiderrors.com/rename-devices-device-manager/


CCS leaves the serial number blank. You have to create a new string
descriptor containing the serial number, and link this into the device
descriptor. The Windows driver doesn't look at the serial number for
purposes of identifying the device, so the existing Windows driver will
still happily run with a serial number added to the device.
spilz



Joined: 30 Jan 2012
Posts: 216

View user's profile Send private message

PostPosted: Tue Mar 16, 2021 12:42 pm     Reply with quote

hello

I tested the method and i'm able to change the name of the driver, but I can't make différence between two device

I changed :
Code:
const char USB_DEVICE_DESC[USB_DESC_DEVICE_LEN] ={
      //starts of with device configuration. only one possible
         USB_DESC_DEVICE_LEN, //the length of this report   ==0
         0x01, //the constant DEVICE (DEVICE 0x01)  ==1
         0x10,0x01, //usb version in bcd  ==2,3
         0x02, //class code. 0x02=Communication Device Class ==4
         0x00, //subclass code ==5
         0x00, //protocol code ==6
         USB_MAX_EP0_PACKET_LENGTH, //max packet size for endpoint 0. (SLOW SPEED SPECIFIES 8) ==7
         USB_CONFIG_VID & 0xFF, ((USB_CONFIG_VID >> 8) & 0xFF), //vendor id       ==9, 10
         USB_CONFIG_PID & 0xFF, ((USB_CONFIG_PID >> 8) & 0xFF), //product id, don't use 0xffff       ==11, 12
         USB_CONFIG_VERSION & 0xFF, ((USB_CONFIG_VERSION >> 8) & 0xFF), //device release number  ==13,14
         0x01, //index of string description of manufacturer. therefore we point to string_1 array (see below)  ==14
         0x02, //index of string descriptor of the product  ==15
         0x03, //index of string descriptor of serial number  ==16
         USB_NUM_CONFIGURATIONS  //number of possible configurations  ==17
   };
to link to 4th position string

and

Code:
#define USB_STRINGS_OVERWRITTEN
   
// Here is where the "CCS" Manufacturer string and "SERIAL DEMO" are stored.
// Strings are saved as unicode.
// These strings are mostly only displayed during the add hardware wizard.
// Once the operating system drivers have been installed it will usually display
// the name from the drivers .INF.
char const USB_STRING_DESC[]={
   //string 0
         4, //length of string index
         0x03, // USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
         0x09,0x04,   //Microsoft Defined for US-English
   //string 1  - manufacturer
         8, //length of string index
         0x03, // USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
         'C',0,
         'C',0,
         'S',0,
   //string 2 - product
         28, //length of string index
         0x03, //USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
         'A',0,
         'B',0,
         'C',0,
         'D',0,
         'E',0,
         'F',0,
         'G',0,
         'H',0,
         'I',0,
         'J',0,
         'K',0,
         'L',0,
         'M',0,
   //string 3 - serial
         10, //length of string index
         0x03, // USB_DESC_STRING_TYPE, //descriptor type 0x03 (STRING)
         '1',0,
         '0',0,
         '0',0,
         '4',0
};


where I change the end of the last string

but I don't find the way differentiate them :(
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group