Page MenuHomeFreeBSD

linsysfs: implemented /sys/class/tty
Needs ReviewPublic

Authored by robin.haberkorn_googlemail.com on Nov 3 2024, 7:18 PM.
Referenced Files
F107422508: D47417.id.diff
Mon, Jan 13, 11:03 PM
Unknown Object (File)
Dec 12 2024, 7:32 PM
Unknown Object (File)
Dec 12 2024, 3:06 PM
Unknown Object (File)
Dec 8 2024, 11:48 PM
Unknown Object (File)
Nov 30 2024, 7:26 PM
Unknown Object (File)
Nov 6 2024, 12:14 AM
Subscribers

Details

Reviewers
None
Group Reviewers
Linux Emulation
Summary
  • Supports libserialport, including all the meta data for USB-based TTY devices.
  • It also implements the dev and uevent nodes with Linuxulator-compatible major and minor device ids, although they are not evaluated by libserialport.
  • uftdi and umodem devices are created under proper /sys/devices/pci nodes including USB descriptors.
  • All other TTY devices - currently only "uart" is supported - get generic per-driver nodes under /sys/devices/platform.

I still have a few open questions:

  • linsysfs_tty_latch_hold() and linsysfs_tty_latch_rele() are copied from linsysfs_net.c. I do not understand why they are necessary instead of plain mtx_lock() and mtx_unlock() to synchronize access to tty_nodes_q.
  • The uftdi_softc, umodem_softc and uhub_softc structures had to be made public. What's the policy on these kinds of changes? They should probably be committed separately and I could create separate diffs if necessary. There is an uncommented block in linsysfs_tty_get(), showing how you could theoretically avoid using umodem_softc and uftdi_softc - but it requires pointer acrobatics and is clearly inferior. I suggest to remove this.
  • I added some debug logging in linsysfs.c, but it resulted in double faults, that I cannot explain. For the time being, I commented out these log() calls. This should either be fixed or the log() calls should be removed if there is a good explanation why they caused crashes.
  • Many files present on Linux are still not implemented.
Test Plan
  • Tested on 14.1-RELEASE-p5 (with some debug options on top of GENERIC), both in a virtual machine and on the desktop.
  • I plugged and removed FTDI-based and TTY ACM devices. Dynamic creation of USB hubs is not tested.
  • tested list_ports and port_info examples of libserialport
  • manually investigated the /sys/class/tty nodes of course

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped