wch/usbfs host: default endpoint table leaves a hubless device 3 data endpoints (was 4)

Aperta Adatta ai principianti
#4,596 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
64/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c
Ambito
embedded-iot

Direzione di ricerca

Inizia da src/portable/wch/usbfs/hcd_wch_usbfs.c: la macro intorno alle righe 55-57 dimensiona la tabella degli endpoint, mentre le righe 148-149 riservano ep[0] per l'indirizzo 0 e assegnano all'EP0 indirizzato un proprio record. Leggi come hcd_edpt_open() (intorno alla riga 762) indicizza quella tabella, poi confronta con il vecchio hcd_ch32_usbfs.c usb_edpt_list[CFG_TUH_DEVICE_MAX*6], che lasciava quattro endpoint dati. Fatto significa che la configurazione predefinita senza hub ammette EP0 più quattro endpoint dati, oppure che il valore predefinito ridotto è documentato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

follow-up Port WCH USBFS Prio 📌

With the default config (CFG_TUH_DEVICE_MAX 1, CFG_TUH_HUB 0), CFG_TUH_WCH_USBFS_ENDPOINT_MAX is 5 (https://github.com/hathach/tinyusb/blob/490eb4ec9/src/portable/wch/usbfs/hcd_wch_usbfs.c#L55-L57). ep[0] is reserved for address 0 and the addressed EP0 takes one record (:148-149), so one hubless device gets 3 data endpoints and hcd_edpt_open() fails on the 4th (:762). The old hcd_ch32_usbfs.c (usb_edpt_list[CFG_TUH_DEVICE_MAX*6], 53c1d1473) left 4.

Found syncing 490eb4ec9 into adafruit/Adafruit_TinyUSB_Arduino#642 (review comment by CodeRabbit), verified in source.

Trigger: default config, no hub, a device with 4 data endpoints (e.g. CDC-ACM with 3 plus a HID IN): the last interface's endpoint fails to open. Overriding the macro works around it.

Introduced by: a76e22cbc ("endpoint table sized by device count").

Remaining work: size per device as 1 (EP0) + 4 data endpoints, matching the comment "control plus about three endpoints" and the old driver's capacity, or document the reduced default.

Why deferred: found on the downstream sync PR, which carries upstream bytes only. Not reproduced on hardware.

Lingua principale
C
Stelle
7.3k
Fork
1.6k
Merge medio
1g 19h
PR unite (30g)
67

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hathach/tinyusb

Tutte le issue di hathach/tinyusb

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.