On Wed, Aug 23, 2023 at 6:20 PM Jeffrey Walton <noloader@xxxxxxxxx> wrote: > > On Wed, Aug 23, 2023 at 5:21 PM Steve Underwood <coppice12@xxxxxxxxx> wrote: > > > > Has anyone used wireshark while using USB serial ports with Fedora 37? > > As soon as I start wireshark the communication on my serial ports > > breaks. Thinking this might be something to do with wireshark scanning > > for available interfaces, I tried starting wireshark with "wireshark -i > > enp3c0", but it still seems to list all the interfaces, and it still > > messes up my serial communication. I'm sure I was doing things like this > > in 2022 without any trouble. > > I have not found myself in your position, so I can't comment on > Wireshark and serial ports. > > But I have been in the position of NetworkManager messing with my > serial ports. To work around it in my code, I made the file descriptor > exclusive so NetworkManager could not open it: > > /* Open the modem. It will be configured for exclusive use below. */ > s_modem = open(device_path, O_RDWR | O_NOCTTY | O_SYNC); > ret = errno; > if (s_modem == -1) { > log_error("Failed to open device %s: %s\n", device_path, > strerror(errno)); > s_modem = 0; errno = ret; > goto finished; > } > > /* Verify the modem is a terminal we can configure and control */ > if (!isatty(s_modem)) > { > log_error("Device %s is not a tty\n", device_path); > close(s_modem); s_modem = 0; > ret = errno = ENOTTY; > goto finished; > } > > /* Get exclusive access to the modem. */ > /* Don't allow NetworkManager and ModemManager access */ > if (ioctl(s_modem, TIOCEXCL, NULL) == -1) { > log_warn("Failed to set TIOCEXCL on device: %s\n", strerror(errno)); > } Oh, and I forgot to mention... if I recall correctly (going back several years)... open() is supposed to use O_EXCL. But I seem to recall it is silently ignored in this case. Hence the need for the ioct() and TIOCEXCL to set an exclusive mode. Jeff _______________________________________________ users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue