Re: How to make /dev/ttyACM0 (and friends) exclusive?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I’m grateful for having you as a friend!

Sent from my iPhone

> On Oct 7, 2020, at 4:41 AM, Daniel Santos <daniel.santos@xxxxxxxxx> wrote:
> 
> Hello!
> 
> I'm not subscribed to this list, but I thought I would resurrect this
> old thread, as I ran across it on the web.
> 
>> On Mon, 04 Mar 2019 16:38:44 +0100, Yann Droneaud said:
>> 
>>> O_EXCL is intended to be used to prevent opening an existing file. Said
>>> differently, it's used to ensure a new file is created, useful to
>>> prevent race condition, where multiple processes compete to create a
>>> file. For example think of temporary file created with random name.
>> 
>> Which means that if you're trying to regulate exclusive use of a character
>> device or similar, you use O_EXCL|O_CREAT to create a lock file, and
> make sure
>> that all the programs competing for the character device use the same
> pathname
>> to create the lock file - which has been a tried-and-true way of handling
>> exclusive locking for serial ports for 4 decades now.
>> 
>> The fact that 'strings /usr/sbin/ModemManager | grep /' proves pretty
> clearly
>> that ModemManager is trusting DBus to keep track of things rather than
> using
>> lock files on the modems is almost certainly part of the reason it's a
> steaming
>> pile of dingo's kidneys rather than a helpful piece of software.
> 
> My solution to this particular dingo terd is this:
> 
> cat << EOF >> /var/udev/rules.d/81-ttyUSB_ACM_no_mm.rules
> KERNEL=="ttyUSB[0-9]*", ENV{ID_MM_DEVICE_IGNORE}="1"
> KERNEL=="ttyACM[0-9]*", ENV{ID_MM_DEVICE_IGNORE}="1"
> EOF
> 
> Very evil indeed.  I have a lot of strange devices attached to serial
> ports or emulating USB CDC ACM devices, and this cost me a lot of time. 
> The funny thing is that I went CDC ACM (on one device) instead of raw
> URBs because I thought it would save me time, but I spent much longer
> trying to figure this out than I saved.
> 
> Daniel
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux