Hi,
this seems like a newbie question, but shouldn't g_serial also work in case
it's builtin?
I tested g_serial with a Raspberry Pi Zero (OTG mode, Linux 4.11-rc1) as gadget
and a Linux Laptop as host (Linux 4.10.9). In case g_serial is build as a
kernel module the RPi gets enumerated on the Linux host and in case of g_serial
builtin not. In both cases i didn't provide any gadget configuration via
configfs or kernel commandline.
Regards
Stefan
Gadget builtin (bad case)
=========================
dmesg (Host)
[19755.687770] usb 2-1.1.3: new high-speed USB device number 20 using ehci-pci
[19756.055743] usb 2-1.1.3: new high-speed USB device number 21 using ehci-pci
[19761.271755] usb 2-1.1.3: device descriptor read/64, error -110
[19776.887724] usb 2-1.1.3: device descriptor read/64, error -110
[19777.075724] usb 2-1.1.3: new high-speed USB device number 22 using ehci-pci
[19782.263715] usb 2-1.1.3: device descriptor read/64, error -110
[19797.879679] usb 2-1.1.3: device descriptor read/64, error -110
[19798.067654] usb 2-1.1.3: new high-speed USB device number 23 using ehci-pci
[19808.759654] usb 2-1.1.3: device not accepting address 23, error -110
[19808.843564] usb 2-1.1.3: new high-speed USB device number 24 using ehci-pci
[19819.511555] usb 2-1.1.3: device not accepting address 24, error -110
[19819.511699] usb 2-1.1-port3: unable to enumerate USB device
.config (RPi Zero)
CONFIG_USB_DWC2=y
CONFIG_USB_DWC2_DUAL_ROLE=y
CONFIG_USB_PHY=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GADGET=y
CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_F_ACM=y
CONFIG_USB_U_SERIAL=y
CONFIG_USB_F_SERIAL=y
CONFIG_USB_F_OBEX=y
CONFIG_USB_G_SERIAL=y
dmesg (RPi Zero)
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.11.0-rc1+ (user@Raspberry) (gcc version 4.7.1
20120402 (prerelease) (crosstool-NG 1.15.2) ) #4 Sat Apr 15 12:31:27 UTC 2017
...
[ 0.691449] udc-core: couldn't find an available UDC - added [g_serial] to
list of pending drivers
...
[ 2.265701] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[ 2.280590] g_serial gadget: Gadget Serial v2.4
[ 2.291998] g_serial gadget: g_serial ready
[ 2.302774] dwc2 20980000.usb: bound driver g_serial
[ 2.314624] dwc2 20980000.usb: DWC OTG Controller
[ 2.325990] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[ 2.339981] dwc2 20980000.usb: irq 33, io mem 0x20980000
[ 2.353571] hub 1-0:1.0: USB hub found
[ 2.364030] hub 1-0:1.0: 1 port detected
Gadget Module (good case)
=========================
dmesg (Host)
[ 83.789606] usb 2-1.1.4: new high-speed USB device number 6 using ehci-pci
[ 84.045604] usb 2-1.1.4: new high-speed USB device number 7 using ehci-pci
[ 89.241203] usb 2-1.1.4: device descriptor read/64, error -110
[ 104.856069] usb 2-1.1.4: device descriptor read/64, error -110
[ 105.044058] usb 2-1.1.4: new high-speed USB device number 8 using ehci-pci
[ 110.231823] usb 2-1.1.4: device descriptor read/64, error -110
[ 125.743732] usb 2-1.1.4: new high-speed USB device number 9 using ehci-pci
[ 125.857294] usb 2-1.1.4: New USB device found, idVendor=0525, idProduct=a4a7
[ 125.857298] usb 2-1.1.4: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[ 125.857300] usb 2-1.1.4: Product: Gadget Serial v2.4
[ 125.857303] usb 2-1.1.4: Manufacturer: Linux 4.11.0-rc1+ with 20980000.usb
[ 125.926208] cdc_acm 2-1.1.4:2.0: ttyACM0: USB ACM device
[ 125.926559] usbcore: registered new interface driver cdc_acm
[ 125.926560] cdc_acm: USB Abstract Control Model driver for USB modems and
ISDN adapters
lsusb (Host)
Bus 002 Device 009: ID 0525:a4a7 Netchip Technology, Inc. Linux-USB Serial
Gadget (CDC ACM mode)
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 2 Communications
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0525 Netchip Technology, Inc.
idProduct 0xa4a7 Linux-USB Serial Gadget (CDC ACM mode)
bcdDevice 4.11
iManufacturer 1
iProduct 2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 75
bNumInterfaces 2
bConfigurationValue 2
iConfiguration 4
bmAttributes 0xc0
Self Powered
MaxPower 2mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 1 AT-commands (v.25ter)
iFunction 7
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 5
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x00
bDataInterface 1
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x000a 1x 10 bytes
bInterval 9
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 6
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
.config (RPi Zero)
CONFIG_USB_DWC2=y
CONFIG_USB_DWC2_DUAL_ROLE=y
CONFIG_USB_PHY=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GADGET=y
CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_F_ACM=m
CONFIG_USB_U_SERIAL=m
CONFIG_USB_F_SERIAL=m
CONFIG_USB_F_OBEX=m
CONFIG_USB_G_SERIAL=m
dmesg (RPi Zero)
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.11.0-rc1+ (user@Raspberry) (gcc version 4.7.1
20120402 (prerelease) (crosstool-NG 1.15.2) ) #2 Fri Apr 14 22:21:12 UTC 2017
...
[ 2.253771] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[ 2.268458] dwc2 20980000.usb: DWC OTG Controller
[ 2.279991] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[ 2.293986] dwc2 20980000.usb: irq 33, io mem 0x20980000
[ 2.307684] hub 1-0:1.0: USB hub found
[ 2.318184] hub 1-0:1.0: 1 port detected
[ 2.330378] ALSA device list:
[ 2.339962] No soundcards found.
[ 2.350193] uart-pl011 20201000.serial: no DMA platform data
[ 2.364385] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature
incompatibilities
[ 2.390330] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly
filesystem
[ 2.404554] EXT4-fs (mmcblk0p2): write access will be enabled during recovery
[ 3.781138] EXT4-fs (mmcblk0p2): recovery complete
[ 3.798902] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode.
Opts: (null)
[ 3.819989] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[ 3.846392] devtmpfs: mounted
[ 3.860526] Freeing unused kernel memory: 1024K
...
[ 45.334793] g_serial gadget: Gadget Serial v2.4
[ 45.334814] g_serial gadget: g_serial ready
[ 45.334834] dwc2 20980000.usb: bound driver g_serial
[ 45.487482] dwc2 20980000.usb: new device is high-speed
[ 45.527592] dwc2 20980000.usb: new device is high-speed
[ 45.552571] dwc2 20980000.usb: new address 6
[ 96.978436] g_serial gadget: high-speed config #2: CDC ACM config
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html