Help disabling the CDC interface on the Uno R4 WiFi

As the title suggests I am having trouble disabling the CDC interface on the Uno R4 WiFi. I made another thread here a few weeks ago where I asked the same question but that wasn't the main question of the post so I guess nobody who had the answer saw the question.

If anybody knows how to do this on the new Uno R4 I would appreciate some help. It used to be very easy on my old Leonardo R3 board where I could just append a flag in the boards.txt or just comment out a few lines in the USBCore.cpp. Thanks in advance.

on Uno R4 WiFi the USB of the main MCU is not used. the ESP32S3 acts as USB-to-TTL-Serial converter

I was about to answer this, the same way as you did here and as I had mentioned in the other thread he linked to.

However what @fary6435 - did not mention in this thread, is that he is wanting to do this for a program that outputs HID:

So this puts this makes the Ra4m1 processor in control.

Wonder what would happen if you somewhere defined: DISABLE_USB_SERIAL

This is in SerialUSB.cpp.

#ifndef DISABLE_USB_SERIAL
// Ensure we are installed in the USB chain
void __USBInstallSerial() { /* noop */ }
#endif

Could be editing source file. Or could maybe be done editing either boards.txt or platform.txt to pass it in...

there are Arduino libraries for mouse and keyboard HID for Uno R4

I am guessing that he knows about these libraries. Or potentially he is trying to define his own HID class.

My understanding of his request is he wants is when he plugs in his device (lets say keyboard), the only interface that will be exposed by the device is his keyboard HID device.

For example I just uploaded to my modified WiFi board the keyboard example.

I then plugged it into Teensy Micromod board, that I programmed with my USBHost_t36 example sketch HIDDeviceInfo, which is a sketch we use to try to understand different USB devices that we may want to add support for...

The output from this (Used TyCommander to capture the Serial Output):



USB HID Device Info Program

This Sketch shows information about plugged in HID devices

*** You can control the output by simple character input to Serial ***
R - Turns on or off showing the raw data
C - Toggles showing changed data only on or off
<anything else> - toggles showing the Hid formatted breakdown of the data


USBDeviceInfo claim this=2000DF04

****************************************
** Device Level **
  vid=2341
  pid=6D
  bDeviceClass = 0
  bDeviceSubClass = 0
  bDeviceProtocol = 0
08 0B 00 02 02 02 00 00 09 04 00 00 01 02 02 00 04 05 24 00 20 01 05 24 01 00 01 04 24 02 02 05
24 06 00 01 07 05 81 03 08 00 10 09 04 01 00 02 0A 00 00 00 07 05 02 02 40 00 00 07 05 82 02 40
00 00 09 04 02 00 00 FE 01 01 05 09 21 0D E8 03 00 10 01 01 09 04 03 00 01 03 00 00 00 09 21 11
01 00 01 22 2F 00 07 05 83 03 40 00 0A 

USBDeviceInfo claim this=2000DF04

****************************************
** Interface Level **
09 04 00 00 01 02 02 00 04 05 24 00 20 01 05 24 01 00 01 04 24 02 02 05 24 06 00 01 07 05 81 03
08 00 10 09 04 01 00 02 0A 00 00 00 07 05 02 02 40 00 00 07 05 82 02 40 00 00 09 04 02 00 00 FE
01 01 05 09 21 0D E8 03 00 10 01 01 09 04 03 00 01 03 00 00 00 09 21 11 01 00 01 22 2F 00 07 05
83 03 40 00 0A 
 bInterfaceNumber = 0
 number end points = 1
 bInterfaceClass =    2
 bInterfaceSubClass = 2
    Communicatons and CDC
 bInterfaceProtocol = 0

USBDeviceInfo claim this=2000DF04

****************************************
** Interface Level **
09 04 01 00 02 0A 00 00 00 07 05 02 02 40 00 00 07 05 82 02 40 00 00 09 04 02 00 00 FE 01 01 05
09 21 0D E8 03 00 10 01 01 09 04 03 00 01 03 00 00 00 09 21 11 01 00 01 22 2F 00 07 05 83 03 40
00 0A 
 bInterfaceNumber = 1
 number end points = 2
 bInterfaceClass =    10
 bInterfaceSubClass = 0
    CDC-Data
 bInterfaceProtocol = 0

USBDeviceInfo claim this=2000DF04

****************************************
** Interface Level **
09 04 02 00 00 FE 01 01 05 09 21 0D E8 03 00 10 01 01 09 04 03 00 01 03 00 00 00 09 21 11 01 00
01 22 2F 00 07 05 83 03 40 00 0A 
 bInterfaceNumber = 2
 number end points = 0
 bInterfaceClass =    254
 bInterfaceSubClass = 1
 bInterfaceProtocol = 1

USBDeviceInfo claim this=2000DF04

****************************************
** Interface Level **
09 04 03 00 01 03 00 00 00 09 21 11 01 00 01 22 2F 00 07 05 83 03 40 00 0A 
 bInterfaceNumber = 3
 number end points = 1
 bInterfaceClass =    3
 bInterfaceSubClass = 0
    HID
 bInterfaceProtocol = 0
    None
report descriptor size = 47
  endpoint = 83
    attributes = 3 Interrupt
    size = 64
    interval = 10
*** Device HID1 2341:6d - connected ***
  manufacturer: Arduino
  product: UNO R4 UWiFi
  Serial: 3805191C58313330CFA233324B57
HIDDumpController(1 : 0x20004220 : 0x20009680) Claim: 2341:6d usage: 10006 SubClass: 0 Protcol: 0 - Yes

HID Report Descriptor (0x200096bc) size: 47
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
  00
*** HID Device hdc1 2341: 6d - connected ***
  manufacturer: Arduino
  product: UNO R4 UWiFi
  Serial: 3805191C58313330CFA233324B57

You will see here, the first two interfaces are for CDC ... Which is the Serial USB stuff, that I believe he is trying to remove.

The last interface is marked as HID. It is interesting that it is not returning any other additional HID information. Like the report descriptor is returning all 0s. So our USB Host code would choke on it.

Sorry, I know maybe a little off topic, but hopefully. explains what I think he is after.