uvc camera怎么修改播放器中列出的名称

Lucky Y 2022-10-21 16:56:40 编辑

161458976562
上图是我的开发板接上windows之后,在使用播放器选择摄像头的时候,看到列出来的名称有UVC Camera,现在想修改这个名称,使得播放器等能够显示自己定义的名称。尝试了修改下图中的UVC Camera字段,
161923370929
结果通过usbviewer扫描之后发现device information的Child Device 1并没有被修改成功,而IAD Descriptor和Interface Descriptor被修改了。
162149149296
162252200507
所以,我应该怎样才能将device information中的字段修改成想要的字符串呢?希望大佬们指点一下:)

ps. 好像这个UVC Camera是注册的friendly name,但是我并不知道注册friendly name使用的是哪个地方的字符串。

USB中文网 2022-10-22 16:02:08 编辑

其实就是视频控制接口或者视频流接口描述符中指定的字符串,你试一下就知道了。

Lucky Y 2022-10-26 15:18:12 编辑

感谢站长的回复!我实在linux上做的开发,然后之前群友有提到修改f_uvc.c里面字符串,我修改之后,在Ubuntu里面打开能够看到相应的改动,然后在windows使用potplayer打开,还是显示UVC Camera,在Ubuntu通过guvcview打开显示lucky UVC Camera,然后我通过USBview扫了一下,下面是摘取的一段log,发现child device2里面的值还是没有改变,我觉得可能windows就是通过这个字段来注册friendly name的,但是不知道在哪可以修改呢?

      ======================== USB Device ========================

        +++++++++++++++++ Device Information ++++++++++++++++++
Device Description       : USB Composite Device
Device Path              : \\?\USB#VID_1D6B&PID_0104#0x7f5a212a#{a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
Kernel Name              : \Device\USBPDO-2
Device ID                : USB\VID_1D6B&PID_0104\0X7F5A212A
Hardware IDs             : USB\VID_1D6B&PID_0104&REV_0040 USB\VID_1D6B&PID_0104
Driver KeyName           : {36fc9e60-c465-11cf-8056-444553540000}\0015 (GUID_DEVCLASS_USB)
Driver                   : \SystemRoot\System32\drivers\usbccgp.sys (Version: 10.0.22000.918  Date: 2022-09-14)
Driver Inf               : C:\WINDOWS\inf\usb.inf
Legacy BusType           : PNPBus
Class                    : USB
Class GUID               : {36fc9e60-c465-11cf-8056-444553540000} (GUID_DEVCLASS_USB)
Service                  : usbccgp
Enumerator               : USB
Location Info            : Port_#0003.Hub_#0001
Location IDs             : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(3), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HSP3)
Container ID             : {dd704621-9772-5d25-9071-44420e8931d7}
Manufacturer Info        : (标准 USB 主控制器)
Capabilities             : 0x94 (Removable, UniqueID, SurpriseRemovalOK)
Status                   : 0x0180600A (DN_DRIVER_LOADED, DN_STARTED, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
Problem Code             : 0
Address                  : 3
HcDisableSelectiveSuspend: 0
EnableSelectiveSuspend   : 0
SelectiveSuspendEnabled  : 0
EnhancedPowerMgmtEnabled : 0
IdleInWorkingState       : 0
WakeFromSleepState       : 0
Power State              : D0 (supported: D0, D3, wake from D0)
 Child Device 1          : Remote NDIS Compatible Device #2 (远程 NDIS 兼容设备)
  Device Path 1          : \\?\USB#VID_1D6B&PID_0104&MI_00#6&31da2b61&0&0000#{ad498944-762f-11d0-8dcb-00c04fc3358c}\{bdb8543f-2aac-426c-9647-f48bd61d8392} (GUID_NDIS_LAN_CLASS)
  Device Path 2          : \\?\USB#VID_1D6B&PID_0104&MI_00#6&31da2b61&0&0000#{cac88484-7515-4c03-82e6-71a87abac361} (GUID_DEVINTERFACE_NET)
  Kernel Name            : \Device\0000032e
  Device ID              : USB\VID_1D6B&PID_0104&MI_00\6&31DA2B61&0&0000
  Class                  : Net
  Driver KeyName         : {4d36e972-e325-11ce-bfc1-08002be10318}\0003 (GUID_DEVCLASS_NET)
  Service                : usbrndis6
 Child Device 2          : UVC Camera (USB 视频设备)
  Device Path 1          : \\?\USB#VID_1D6B&PID_0104&MI_02#6&31da2b61&0&0002#{6994ad05-93ef-11d0-a3cc-00a0c9223196}\global (AM_KSCATEGORY_VIDEO)
  Device Path 2          : \\?\USB#VID_1D6B&PID_0104&MI_02#6&31da2b61&0&0002#{e5323777-f976-4f5b-9b55-b94699c46e44}\global (STATIC_KSCATEGORY_VIDEO_CAMERA)
  Device Path 3          : \\?\USB#VID_1D6B&PID_0104&MI_02#6&31da2b61&0&0002#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global (AM_KSCATEGORY_CAPTURE)
  Kernel Name            : \Device\0000032f
  Device ID              : USB\VID_1D6B&PID_0104&MI_02\6&31DA2B61&0&0002
  Class                  : Camera
  Driver KeyName         : {ca3e7ab9-b4c3-4ae6-8251-579ef933890f}\0007 (GUID_DEVCLASS_CAMERA)
  Service                : usbvideo

        +++++++++++++++++ Registry USB Flags +++++++++++++++++
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\1D6B01040040
 osvc                    : REG_BINARY 01 CD
 SkipContainerIdQuery    : REG_BINARY 01 00






        ------------------- IAD Descriptor --------------------
bLength                  : 0x08 (8 bytes)
bDescriptorType          : 0x0B
bFirstInterface          : 0x02
bInterfaceCount          : 0x02
bFunctionClass           : 0x0E (Video)
bFunctionSubClass        : 0x03 (Video Interface Collection)
bFunctionProtocol        : 0x00 (PC_PROTOCOL_UNDEFINED protocol)
iFunction                : 0x09 (String Descriptor 9)
 Language 0x0409         : "lucky UVC Camera"
Data (HexDump)           : 08 0B 02 02 0E 03 00 09                           ........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x02
bAlternateSetting        : 0x00
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x0E (Video)
bInterfaceSubClass       : 0x01 (Video Control)
bInterfaceProtocol       : 0x00
iInterface               : 0x09 (String Descriptor 9)
 Language 0x0409         : "lucky UVC Camera"
Data (HexDump)           : 09 04 02 00 01 0E 01 00 09                        .........



        ------------------- IAD Descriptor --------------------
bLength                  : 0x08 (8 bytes)
bDescriptorType          : 0x0B
bFirstInterface          : 0x02
bInterfaceCount          : 0x02
bFunctionClass           : 0x0E (Video)
bFunctionSubClass        : 0x03 (Video Interface Collection)
bFunctionProtocol        : 0x00 (PC_PROTOCOL_UNDEFINED protocol)
iFunction                : 0x09 (String Descriptor 9)
 Language 0x0409         : "lucky UVC Camera"
Data (HexDump)           : 08 0B 02 02 0E 03 00 09                           ........

        ---------------- Interface Descriptor -----------------
bLength                  : 0x09 (9 bytes)
bDescriptorType          : 0x04 (Interface Descriptor)
bInterfaceNumber         : 0x02
bAlternateSetting        : 0x00
bNumEndpoints            : 0x01 (1 Endpoint)
bInterfaceClass          : 0x0E (Video)
bInterfaceSubClass       : 0x01 (Video Control)
bInterfaceProtocol       : 0x00
iInterface               : 0x09 (String Descriptor 9)
 Language 0x0409         : "lucky UVC Camera"
Data (HexDump)           : 09 04 02 00 01 0E 01 00 09                        .........


      -------------------- String Descriptors -------------------
             ------ String Descriptor 0 ------
bLength                  : 0x04 (4 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language ID[0]           : 0x0409 (English - United States)
Data (HexDump)           : 04 03 09 04                                       ....
             ------ String Descriptor 1 ------
bLength                  : 0x0C (12 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "hobot"
Data (HexDump)           : 0C 03 68 00 6F 00 62 00 6F 00 74 00               ..h.o.b.o.t.
             ------ String Descriptor 2 ------
bLength                  : 0x08 (8 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "xj3"
Data (HexDump)           : 08 03 78 00 6A 00 33 00                           ..x.j.3.
             ------ String Descriptor 3 ------
bLength                  : 0x16 (22 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "0x7f5a212a"
Data (HexDump)           : 16 03 30 00 78 00 37 00 66 00 35 00 61 00 32 00   ..0.x.7.f.5.a.2.
                           31 00 32 00 61 00                                 1.2.a.
             ------ String Descriptor 4 ------
bLength                  : 0x0E (14 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "Conf 1"
Data (HexDump)           : 0E 03 43 00 6F 00 6E 00 66 00 20 00 31 00         ..C.o.n.f. .1.
             ------ String Descriptor 5 ------
bLength                  : 0x3A (58 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "RNDIS Communications Control"
Data (HexDump)           : 3A 03 52 00 4E 00 44 00 49 00 53 00 20 00 43 00   :.R.N.D.I.S. .C.
                           6F 00 6D 00 6D 00 75 00 6E 00 69 00 63 00 61 00   o.m.m.u.n.i.c.a.
                           74 00 69 00 6F 00 6E 00 73 00 20 00 43 00 6F 00   t.i.o.n.s. .C.o.
                           6E 00 74 00 72 00 6F 00 6C 00                     n.t.r.o.l.
             ------ String Descriptor 6 ------
bLength                  : 0x28 (40 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "RNDIS Ethernet Data"
Data (HexDump)           : 28 03 52 00 4E 00 44 00 49 00 53 00 20 00 45 00   (.R.N.D.I.S. .E.
                           74 00 68 00 65 00 72 00 6E 00 65 00 74 00 20 00   t.h.e.r.n.e.t. .
                           44 00 61 00 74 00 61 00                           D.a.t.a.
             ------ String Descriptor 7 ------
bLength                  : 0x0C (12 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "RNDIS"
Data (HexDump)           : 0C 03 52 00 4E 00 44 00 49 00 53 00               ..R.N.D.I.S.
             ------ String Descriptor 9 ------
bLength                  : 0x28 (40 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "lucky UVC Camera"
Data (HexDump)           : 28 03 68 00 75 00 61 00 6E 00 67 00 79 00 75 00   (.h.u.a.n.g.y.u.
                           6E 00 20 00 55 00 56 00 43 00 20 00 43 00 61 00   n. .U.V.C. .C.a.
                           6D 00 65 00 72 00 61 00                           m.e.r.a.
             ------ String Descriptor 10 ------
bLength                  : 0x20 (32 bytes)
bDescriptorType          : 0x03 (String Descriptor)
Language 0x0409          : "Video Streaming"
Data (HexDump)           : 20 03 56 00 69 00 64 00 65 00 6F 00 20 00 53 00    .V.i.d.e.o. .S.
                           74 00 72 00 65 00 61 00 6D 00 69 00 6E 00 67 00   t.r.e.a.m.i.n.g.
USB中文网 2022-10-26 17:26:52 编辑

其实这与Windows的机制有关系的,比如同一个PID和VID等相同的信息,你刚开始的名字叫ABCD,后面你把字符串改成DEFG了,那么重新插入电脑无论是MIC还是摄像头还是原来的那个名字的,叫做ABCD,而不是新的DEFG.
所以你需要先在设备管理器中清除原来的设备信息。然后再插入设备,这样才能用新的设备名称来显示。
具体的操作过程可以看B站的这个视频:https://www.bilibili.com/video/BV1ye4y177TS/?spm_id_from=333.999.0.0
里面当动态创建虚拟MIC和CAMERA的时候,当我们需要改变设备名称的时候,需要先删除以前的信息。
另外如果你不想那么搞的话,就把PID和VID变了,变成一个以前没见过的,这样系统就认为是一个新的设备,重新枚举的,而如果不改,就得按我上面说的那样做,因为电脑认为是同一个设备,就用了自己以前记录的名字,而不再次获取,即使你已经变了。

Lucky Y 2022-10-27 20:27:42 编辑

感谢站长,也在群里面回复了之前指点了的群友,么么哒~