Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jul 2020 20:20:52 +0000
From:      "Brian Mcgovern (bmcgover)" <bmcgover@cisco.com>
To:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Question on structure of USB (specifically USB Serial) stack
Message-ID:  <BL0PR11MB34425EBBCF3E674E6A7766E1C57F0@BL0PR11MB3442.namprd11.prod.outlook.com>

next in thread | raw e-mail | index | archive | help
All,
  I'm doing some playing with the ucom code, and I'm down to a link in the =
data that I'm just not confident I've parsed the code correctly. In sys/dev=
/usb/serial/usb_serial.c,  specifically in ucom_attach_tty, I'm trying to g=
et a reference to the usb_device structure for the device used elsewhere in=
 the USB code. The specific devices I'm working with are USB->RJ 45 cables =
with a built in FTDI chip, in case this matters

  It appears that the ucom_super_softc and ucom_softc structures are availa=
ble. From looking around the code, it appears the sc_parent field of ucom_s=
oftc is pointing back to the uftdi_softc structure in uftdi.c (for the uftd=
i case), so the path would be ucom_softc->sc_parent->sc_udev, but my concer=
n is going through the void *, as it appears each of the devices that use u=
com as the base have sc_udev in a different part of their structure, meanin=
g I'm likely going to crash the system if I plan on it being an FTDI device=
, and its not. Is there a callback or a canonical mechanism for accessing t=
his part of the structure given a starting point of the ucom_softc? Alterna=
tively, are there any well defined attributes I can use to figure out what =
that void* is pointing to, or at least conditionalizing the code so I can d=
ereference it correctly?

   -Brian




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BL0PR11MB34425EBBCF3E674E6A7766E1C57F0>