Page MenuHomeFreeBSD

uchcom: extend hardware support, other enhancements
ClosedPublic

Authored by avg on May 20 2018, 9:43 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 1, 1:14 PM
Unknown Object (File)
Feb 16 2024, 7:51 PM
Unknown Object (File)
Jan 26 2024, 10:13 AM
Unknown Object (File)
Jan 26 2024, 6:25 AM
Unknown Object (File)
Jan 12 2024, 12:53 AM
Unknown Object (File)
Dec 23 2023, 2:25 PM
Unknown Object (File)
Dec 1 2023, 7:26 AM
Unknown Object (File)
Nov 21 2023, 9:33 AM
Subscribers

Details

Summary

This change primaily adds support for a UBS<->RS232 adapter based on CH340 (or an analogue) that I own.
The device seems to have a newer internal version (0x30) and the existing code incorrectly configures line control for it
resulting in garbled transmission.
The changes are based on what I learned in Linux drivers for the same hardware.

Additional changes:

  • add bit definitions seen in the Linux code
  • fix bit definitions that did not match those in Linux, all of them previously unused
  • remove a duplicate definition for UCHCOM_REG_LCR1 as UCHCOM_REG_BREAK2
  • distinguish CH340 and CH341 based on documented product IDs rather than on device IDs (this is purely cosmetic as it does not affect control flow)
  • add more debugging prints
  • add a special tweak of UCHCOM_REG_BPS_PRE seen in Linux to prevent data buffering
  • explicitly reject two stop bits and parity as the driver currently does not support them
  • use UCHCOM_REG_LCR1 / UCHCOM_REG_LCR2 of explicit 0x18 and 0x25
  • use NULL instead of 0 where a pointer is expected
Test Plan

Tested with my device.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

remove a change not intended for comitting

Check build with USB_DEBUG=1 before committing and also w/o:

make -C sys/modules/usb/uhcom
make -C sys/modules/usb/uhcom clean
make -C sys/modules/usb/uhcom DEBUG_FLAGS="-DUSB_DEBUG=1"

--HPS

This revision is now accepted and ready to land.May 21 2018, 8:10 AM
This revision was automatically updated to reflect the committed changes.