Lockdir Serial
- lorelei-jodoin117i
- Aug 16, 2023
- 6 min read
The most important of the two classes of serial device has a majornumber of 4, and its device special files are namedttyS0, ttyS1, etc. Thesecond variety has a major number of 5, and was designed for use whendialing out (calling out) through a port; its device special files arecalled cua0, cua1, etc. Inthe Unix world, counting generally starts at zero, while laypeopletend to start at one. This creates a small amount of confusion forpeople because COM1: is represented by/dev/ttyS0, COM2: by/dev/ttyS1, etc. Anyone familiar with IBM PC-stylehardware knows that COM3: and greater were neverreally standardized anyway.
The cua devices were created to provide asolution to this problem. Rather than relying on the use of lock filesto prevent clashes between programs wanting to use the serial devices,it was decided that the kernel could provide a simple means ofarbitrating who should be given access. If thettyS device were already opened, an attempt toopen the cua would result in an error that aprogram could interpret to mean the device was already being used. Ifthe cua device were already open and an attemptwas made to open the ttyS, the request wouldblock; that is, it would be put on hold and wait until thecua device was closed by the other process. Thisworked quite well if you had a single modem that you had configuredfor dial-in access and you occasionally wanted to dial out on the samedevice. But it did not work very well in environments where you hadmultiple programs wanting to call out on the same device. The only wayto solve the contention problem was to use lock files! Back to squareone.
lockdir serial
Assume your modem is on COM2:. Its minor number will be 65, and itsmajor number will be 4 for normal use. There should be a device calledttyS1 that has these numbers. List the serialttys in the /dev/ directory. The fifth and sixthcolumns show the major and minor numbers, respectively:
The various Linux distributions use slightly differing strategies forwho should own the serial devices. Sometimes they will be owned byroot, and other times they will be owned byanother user, such as uucp in our example.Modern distributions have a group specifically for dial-out devices,and any users who are allowed to use them are added to this group.
Lock files for devices and other resources shared by multipleapplications, such as the serial device lock files that wereoriginally found in either /usr/spool/locks or/usr/spool/uucp, must now be stored in/var/lock. The naming convention which must beused is "LCK.." followed by the base name of the device. For example,to lock /dev/ttyS0 the file "LCK..ttyS0" would be created.[43]
Thanks, but no joy. "/dev/tty.usbserial-A600487i" is listed whenever the board is connected. Pasting it into the preferences did not enable the Serial Port menu and the IDE still can not talk to the board. The error message simply changed to saying it can't find /dev/tty.usbserial-A600487i rather than COM1.
Can you try uploading a sketch from another computer? In particular, try uploading, say, the ASCII Table example. Then, if it works, on your computer, run:screen /dev/tty.usbserial* 9600Do you see the output from the sketch?
Well... good news and bad news. I just completed loading everything on my OLD G3-400 and it CAN talk to the Diecimila. Blink and ASCII Table both ran fine so the card is proven OK. I left ASCII Table loaded on the card and moved it back to the MacBook Pro where it's needed and nothing changed. Serial Port is greyed out and the serial monitor will not even fire up. I believe the first couple console lines may hold the main clue:
java.lang.ClassCastException: gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriverprocessing.app.SerialException: Serial port '/dev/tty.usbserial-A600487i' not found. Did you select the right one from the Tools > Serial Port menu?
I've had similar trouble with the Java RXTX library. I've copied it to /Library/Java/Extensions for use into Eclipse (Target Management/Terminal/Serial) and the Arduino environnement became unable to access the serial port until it was completely removed.
This little thing (RXTXcomm.jar) has indeed a very strange behaviour, since when it's supposed to allow the Eclipse Terminal (part of Target Management Project) to connect to serial ports, it just have the same behavior within Eclipse than anywhere else : It can't connect to any port and just says it is busy or just non existing.
I wrote an open source Mac OS X application that creates a virtual MIDI drum instrument from Arduino serial output. This eliminates the need for additional MIDI hardware. Just plug in your Arduino USB, start the Ardrumo application, then your favorite MIDI sequencer (e.g. GarageBand). See this site for details and downloads: Google Code Archive - Long-term storage for Google Code Project Hosting. for details.
And when I look at the serial monitor (with your ardumo ardunio code) I'm seeing a constant sending between 0 - 400 (give or take, there are spikes) and when I hit it, it usally only registers in the 420-500 area, with some going up into the thousands for what appears to be no reason (doesn't match the strength I hit it at).
What kind of numbers do you get in your serial monitor, a) when nothing is happening and b) when you hit it, and when you do hit it do you get just one number or does your java program smooth it out? ( I get multiple readings per hit) I'm thinking my numbers must be varying a lot more then yours.
hey, this is way cool! I'm working on more of the physical side of the interface... ( ) To my reluctant resignation, I've been pursuing the physical MIDI route. I much prefer your serial to virtual midi approach, but I ran into some system freeze problem. If I can reliably reproduce it, I will send the details along, otherwise, chalk it up to user-error.
I hooked up an old Super Nintendo Joypad to my Arduino board and succeeded in sending Controller messages to Ableton Live, but only on a Windows XP system using the serial to MIDI drivers suggested in the above mentioned thread. As I am migrating to Mac at the moment I'm very interested in finding a solution for this platform, but unfortunately my own programming skills are limited to Arduino code
--When I check the arduino window, I had decent value from Piezo--When I open Garageband then Ardrumo, Garageband told me there's a midi available--When I check the serial port, they are the same in Arduino and Ardrumo :/dev/tty.usbserial-A1000geC
I've been trying to do some project like you, but using puredata for the interface, and i got some problems to connect arduino and pure data.I don't know how to take de signal from arduino, read it, and send to the pure data. The data output from arduino is midi data or serial data??? it's travelling via usb to mac or pc???How you take the signla form arduino and send to your MAC OS interface???
I'm curious: what are serial interfaces? What's an example or two of the things you are talking about?I'm curious, but I imagine this might be useful if it's what I think it is. A coworker manages a digital closed-circuit television system that has something to do with RS-232, I hear.-----osxpounder
Greg Shenaut [ Reply to This # ] Use minicom as a serial-interface terminal application Authored by: dkwyman on Oct 29, '04 09:49:25AM The open source "screen" command is pre-installed in the Mac OS X.Solaris users will recall the "tip" command. I use "screen" and a USB-serial adapter when I need quick-and-dirty terminal emulation via a serial port.===========================================screen man page: screen -r [[pid.]tty[.host]] screen -r sessionowner/[[pid.]tty[.host]]DESCRIPTION Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). Each virtual terminal provides the functions of a DEC VT100 terminal and, in addition, sev- eral control functions from the ISO 6492 (ECMA 48, ANSI X3.64) and ISO 2022 standards (e.g. insert/delete line and support for multiple character sets). There is a scroll- back history buffer for each virtual terminal and a copy- and-paste mechanism that allows moving text regions between windows.clip
Thank you!!! I've been trying to figure out how to get tip/cu finctionality out of OSX. I was using zterm, but it crashes hard, and I can't kill it, even with a "kill -9" I have a soekris Net4801 that I would like to connect to via a IOGear USB-Serial adapter. This did the trick!FYI, the command was:screen /dev/tty.usbserial (depends on the device your driver creates)-Andy
I just compiled minicom on an XServe. Here are a few things to be aware of re: the serial port.1) Just like any cisco router or HP switch, etc, the XServe is configured to listen with a secure terminal on the serial port, for config purposes. Disable this before trying to use the serial port for other purposes. You might *think* of editing /etc/ttys, but you actually want to edit /System/Library/StartupItems/SerialTerminalSupport/SerialTerminalSupport -- and edit the line halfway through to say,ENABLE_SERIAL_TERMINAL=$FALSEOnce this is done, it's easiest to just reboot the machine.2) As mentioned above, the serial port is /dev/tty.serial. Here are some of the defaults I compiled into the program:./configure --enable-dfl-port=/dev/tty.serial --enable-lock-dir=/var/spool/lock --enable-dfl-baud=9600(of course, that's because my application is to talk to a device at 9600N81, YMMV.)3) Notice the lock dir mentioned above. There is no /usr/spool/uucp, or /var/lock, as mentioned in the man page. That's why I compiled it with /var/spool/lock instead. I also ended up modifying the permissions on the lock directory, but there's probably a better way to do that. Again, just FWIW.Hope this is helpful to someone. 2ff7e9595c
Comments