https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288953
Bug ID: 288953
Summary: uchcom(4) wrong modem status
Product: Base System
Version: Unspecified
Hardware: Any
OS: Any
Status: New
Severity: Affects Some People
Priority: ---
Component: usb
Assignee: [email protected]
Reporter: [email protected]
Created attachment 263070
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=263070&action=edit
patch for 13.5-RELEASE-p2
For CH340G, CH341A3, CH341B, ioctl(TIOCMGET) return signal states:
DCD as TIOCM_DSR
DSR as TIOCM_DCD
I think all other versions of CH340/341 are affected too.
A bit-swap needed between SER_DSR and SER_DCD in sys/dev/usb/serial/uchcom.c,
void uchcom_convert_status().
This is probably an incorrect porting of NetBSD driver, where the constants for
DSR and DCD have opposite values:
NetBSD
#define UMSR_DCD 0x80
#define UMSR_RI 0x40
#define UMSR_DSR 0x20
#define UMSR_CTS 0x10
#define UMSR_DDCD 0x08
#define UMSR_TERI 0x04
#define UMSR_DDSR 0x02
#define UMSR_DCTS 0x01
FreeBSD
#define SER_DTR 0x0001
#define SER_RTS 0x0002
#define SER_STX 0x0004
#define SER_SRX 0x0008
#define SER_CTS 0x0010
#define SER_DCD 0x0020
#define SER_RI 0x0040
#define SER_DSR 0x0080
The following patch fixes the problem.
I don't understand why the changed bits are written to low part of sc->sc_msr,
I couldn't find where FreeBSD uses them, so I removed it.
--
You are receiving this mail because:
You are the assignee for the bug.