AppleScript to determine if serial port has something connected

Hi all,
I'd like to know if it is possible to detect if something is attached to the serial port.
I have two USB uart which are connected to my mac mini. They are recognized by the serial port as "usbmodem" and then a number.
I'd like to restart my computer is the Mac doesn't see them both.
Any tip?
Thanks!

I think your problem is going to be two-fold.
Firstly, serial devices are generally dumb - there's no easy way to tell if something's connected other than to try sending some data and seeing what comes back. Even then, depending on the device, the lack of response doesn't necessarily indicate nothing is connected. You'd need to know more about the kind of device you expect to be there, and how you interact with it (or, at least, how it responds) to be able to do anything.
Of course, this is a two-level thing... you have to check that not only is the USB device is connected (which is probably easy enough), but also that there's something plugged into the USB device itself.
The second problem is that access to serial devices tends to be singular - that is, if there's some other software already accessing that device, then your script is likely to fail when it tries to connect. Depending on the nature of that failure it might be hard to differentiate between 'nothing connected' and 'someone else is using this device'. Again, the specifics of the device will come into play here.
That said, you still have to be able to talk to the devices in the first place, and that's not easy. Serial ports haven't been standard on Macs for many years, so you're dependent on the software provided by the USB device vendor - you should check their documentation (if any) to determine whether they provide a mechanism for querying the device state.
The alternative would be to manipulate whatever software you're using to communicate with the serial device - it may be easier to script that application to determine the serial device's state, rather than try to query the serial port directly. That's certainly the path I'd look to first.

Similar Messages

  • Determining the Serial port number

    I need to test my board on 3 PCs randomly.Each time i connect the board the serial port number like "com 18" is getting changed.Now the comport number i am using is 40.Though i dont any other USB connection.Though i refresh i still get  the data only if i define the port number as 40.Is there anyway to determine the port number.Also can someone tell me why this is happening?
    Solved!
    Go to Solution.

    I think you have USB 1.0, it will always take a new port number if you install a new one. (:unsure)
    To find the right COM-Port of your device you can do following:
    1) send anything on each port and wait a little for the right answer, if OK,than take this port for communication.
    or 2) you can get the description string of all ports installed from the device manager. If your USB-Serial-converter have a unique description string, you cann compare all descriptions with your one, and if it conforms, thank take this port for communication.
    LabVIEW Portal

  • Port has bad connection for charge and data

    how can I rescue my address book on the Blackberry when the mini-USB port is damaged or worn-out?
    When I plug-in the known-good charger and the known-good wire to try to connect/power the BBerry, the device is very sensitive to being on or off, and I cannot hold it in connected position for very long.
    Any ideas?

    Hi and Welcome to the Forums!
    Bluetooth -- see this KB:
    KB04132 How to set up Bluetooth connectivity between a BlackBerry smartphone and BlackBerry Desktop Manager
    With that, you will be able to take a backup of your entire device and/or integrate it to a desktop PIM.
    Good luck and let us know!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Is there a way to see if a subvi has something connected to a terminal?

    If I have a sub vi inside a main program and the terminal is not required. Is there a way to know if something is connected to the terminal?
    Tim
    Johnson Controls
    Holland Michigan
    Solved!
    Go to Solution.

    to test at runtime, you can set the default to some bogus value like 'nan' or -1 or empty string.  If this is still the value in the subvi you can tell if the value is still the default value and most likely not wired.  At edit time, scripting can accomplish this (not for the novice).
    What are you trying to do?  The answer might debend on this.
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Using USB Printer on Beige G3 with Localtalk/Serial Port - How?

    I have an Epson Stylus 740 which has both DIN 8/Serial port and USB connections, but the serial quit showing-up, so I want to connect via the USB connector. Is this possible?
    Is there an adapter from DIN 8 Serial/Localtalk connector on Beige G3 to USB for Printer?
    Or do I need to buy a PCI to USB card?
    Other solution?
    thanks

    Russo:
    If you tried to connect an adaptor to the serial port that had a USB connector on the end, it probably won't work since the serial port isn't currently working. You'd need a USB PCI card to connect to the USB.
    I have this same printer, originally used the serial port and then switched to USB when I got the PCI card. This has worked great.
    You should see if something got turned off. Look at these:
    Under the Apple Menu>Control Panel > AppleTalk - make sure the printer port is selected
    Under Apple Menu>Control Panel > Remote Access > Modem (from the drop down menu) - make sure that the printer port isn't selected
    Under Apple Menu > Control Panel > USB Printer sharing - make sure that is turned OFF.
    You might also have to install drivers for the Epson from the disk that came with it. If you insert the CD and choose "custom install" you'll get another screen that allows you to choose the serial driver package.
    Post back if you get it working (or don't).
    HTH.
    A

  • Coldfusion to serial port

    Hi
    I have a flash application that uses coldfusion to interact
    with a database.
    Im trying to get the same application to either commniicate
    with the serial port via Actionscript or Coldfusion.
    Is either possible?

    For ColdFusion running on Windows, to talk to the
    server
    serial port, maybe something like <CFEXECUTE
    NAME="mySerialTalker.bat"> would work. Check out
    http://livedocs.adobe.com/coldfusion/6/CFML_Reference/Tags-pt126.htm.

  • Serial Port IP Address

    My question might be silly, but i need to know, what is the purpose of having IP address on Serial Port, instead we can use the IP address of Ethernet Port by entering "ip unnumbered ethernet 0" on serial port isn't?

    i am using EIGRP & the serial port has "ip unnumbered ethernet 0"
    router eigrp 4444
    network 172.17.0.0
    interface ethernet 0
    ip address 172.17.21.1 255.255.252.0
    but still it workz, but still i am not getting any clearly picture why on a serial port IP address has to me mentioned.can me tell me more clearly? thankz in advance.

  • How do I determine what workstations my iPad has been connected to?

    Hi, as a workaround to a different issue I'm presented with (preventing data from being copied from an iPad to an unauthorized pc), I'm trying to find a way within the iPads logfiles to determine what the device has been connected to? The devices have had all wireless capability disabled so can only connect via USB.
    Thanks

    There are log reading apps.
    I did find apps in the app store to read console logs.  I stopped looking after finding these two:
    https://itunes.apple.com/us/app/consuela/id481121105?mt=8
    https://itunes.apple.com/us/app/device-log-viewer/id489202498?mt=8
    In supervised mode should block connection to random pc.
    There are three ownership models:   
        *    Personal
        *    Institution
        *    Layered. combines personal & institution.
    Watch this apple video on layered ownership.  It education based, but that's OK.
    http://www.apple.com/education/resources/videos/#ios-layered-ownership
    IT Resources -- ios & OS X -- This is a fantastic web page.  I like the education site over the business site.
    View documentation, video tutorials, and web pages to help IT professionals develop and deploy education solutions.
    http://www.apple.com/education/resources/information-technology.html
       business site is:
       http://www.apple.com/lae/ipad/business/resources/

  • Msi 5124 serial port com1 com2

    i have a mainboard msi 5124 and want to use the serial port (COM1) for connecting a standard serial mouse. however i cannot get the mouse to work nor even be detected. not under dos nor under win98.
    before i used a ps/2 mouse, and never a serial mouse.
    most likely the pin-connections are not correct.
    can someone please give me a layout of the pins of the COM1 and COM2 port on the mainboard? on the msi homepage the manual is just 6 pages - which do not cover this information
    thank you,
    PS: the keyboard i am using is still ps/2 and is working fine.

    YOU CAN USE ACTIVEX COM CONTROLS IN YOUR FORM.

  • Problem connecting N79 to serial port using blueso...

    Greeetings to All,
    I have a big problem, when i connect my n79 using bluesoleil v3.0, i got File transfer, dialup networking and object push services only.
    If i try to start serial port service to connect my n79 to a serial port it displayes error "can not start service".
    i have tried various bluesoleil versions but the problem remains same everytime. on the other hand i can connect my sony k750i to a serial port without any problem.
    can someone tell me how to connect n79 to a serial port using bluesoleil
    OR
    Does N79 not support bluetooth serial port connectivity?
    or is there any other way to connect n79 to a serial port using blesoleil and my bluetooth dongle on a WINXP SP2 system?
    Thanks in Advance

    Yes, PCSuite supports a great deal of Bluetooth drivers. These are all built in so, give it a try.
    Windows Vista x32 en x64 editions:
    Microsoft Windows Bluetooth stack
    Toshiba Bluetooth stack, driver versie 5.10.12
    IVT BlueSoleil Bluetooth stack, driver versie 5.0.5
    Windows XP x64:
    Microsoft Windows Bluetooth stack
    Toshiba Bluetooth stack, driver versie 5.10.12
    IVT BlueSoleil Bluetooth stack, driver versie 5.0.5
    Windows XP:
    Microsoft Windows Bluetooth (enkel in Service Pack 2)
    Toshiba Bluetooth stack, driver versie 4.0, 5.0 and 5.10.12
    WIDCOMM Bluetooth stack, driver versie 1.4.2, 3.x, 4.x and 5.x
    IVT BlueSoleil Bluetooth stack, driver versie 2.x, 3.x and 5.0.5
    ‡Thank you for hitting the Blue/Green Star button‡
    N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009

  • Serial port A has gone dead, B is ok, how to use it with rommon?

    Good day,
    the serial port A on E250 has gone dead. The communication is one-way, I can send, but no response is received. However serial port B is ok. Question is, how can I use port B for rommonitor/solaris install?
    Thanks,

    well, here's a thought... but i'm not sure how useful it will be to either of you if the system currently won't boot.
    the openboot environment variables you're going to change are input-device and output-device
    if you were at an ok> prompt, you could simply type 'setenv input-device ttyb', i think you'd also have to set the output-device :)
    if you were booted into solaris, you could use the /usr/platform/<your platform here>/sbin/eeprom command to set the eeprom values, for both of you, your platform is sun4u, so you would type:
    /usr/platform/sun4u/sbin/eeprom input-device=ttyb
    likewise for output-device, you can check your eeprom settings by running eeprom without any arguments.
    if you can't boot up currently... then... uh... crap... that's tough... if you can't get into it at all you're gonna have to call sun... probably want to replace that motherboard anyways...
    fred

  • How to read serial port only when new data has been sent to it

    I've written this very simple vi to read the serial port whenever the MKS Helium Detector sends a new value.  The timing of new data is controlled directly from the front panel of the MKS instrument.  I thought it was as simple as looking at the "bytes at port", and reading the port only if the value is not zero.  The problem I'm having is that the read function is occuring whether I want it to or not.  Consequently, the "Scan from String" function is returning an error (0) once in a while, because it's reading the serial port as it's being updated (I think).   Apparently, when the port is in the process of being updated, it is not zero.   Anyway, I'm assuming there is a simple fix, but I'm having no luck finding the Easter egg.  Any help would be, as always, very much appreciated. 
    Attachments:
    MKSRead.vi ‏55 KB

    You can approach your problem in a couple of ways. The way you've got it written now, as soon as the number of bytes is non-zero, you read and convert. This means that when a partial string is there, you conversion is nor correct. One way is to wait until non-zero bytes like you do now, and then in another loop, read until the byte count is equal to zero and then do the conversion. You can also read until the cr\lf is detected and then do the conversion on the string. You can also enable the termination character for the read but then you'll have to increase the number of bytes to read to something other than just the number of bytes first available. If the instrument always returns the same number of bytes, you can use that as a constant for the VISA Read. Then the read will terminate whenever the byte count OR the termination character is detected.
    I modified your VI to show you how you might put it in a loop and what for the CR/LF to be detected. You would want to add a timeout to this so that if the character does not show up, the loop will not run infinitely
    Attachments:
    MKSRead_mod.vi ‏68 KB

  • Send thru serial port (RS232) the instruction CTRL+"something"

    How to i send thru a serial port (RS232) the instruction "CTRL", like CTRL+"something", im only looking for the special character CTRL, i have seen that it can send a CTRL+A ... CTRL+Z thru a type cast, but  is not what im looking for, im sending a special instruction (CTRL+PQT<package>) thats requires this character.
    reards

    The control key is not something you can send through a serial connection.  It is a modifier key (like Shift and Alt) and not a character that would have an ASCII value associated with it.
    However, many of the special ASCII control characters (those below decimal 32) can often be entered as a CTRL+key combination.  For instance, the beep is ASCII 8 and is also a CTRL-G combination.  The backspace is ASCII 9 and CTRL-H.  CTRL A is ASCII 1 so sending a string set in hex display as 01 or \01 in \codes display would work.
    What is (CTRL+PQT<package> supposed to mean?  Is it Ctrl P followed by Q T then something else?  What equipment are you trying to interface with?

  • How can I use the output value from SIMPLE PID to write something to the serial port?

    I am working on my Senior Design Project that requires the use of incoming compressed air, propotional valves, continuous servo motors, and a serial servo motor microcontroller.  I have figured out how to send byte sequences to the microcontroller through LabVIEW using the VISA serial write function.  The motors are attached to the valves to control the flow rate.  I have created my own simple feedback system using a bunch of case structures but I realized that I am basically trying to recreate the wheel (I basically was writing my own PID VI).   I have an older version of LabVIEW (7.0 Express) and theres no way to upgrade or buy the PID toolkit, so I am stuck using the Simple PID VI.  Also, the only way the motor works is sending an array of bytes to tell it to turn on/off, direction, and speed.  Is there any way I can use the Simple PID VI in conjunction with the VISA SERIAL write function, or is there any other way I can communicate with the serial port using this pid vi?  Any information would be appreciated.

    Hi gpatel,
    you know how to communicate to serial port, but you don't know how to send a value from SimplePID to serial port???
    You know how to communicate, but then you don't know how to communicate???
    You should explain this in more detail...
    Edit:
    From you first post you know what values your motor driver is expecting. You know which values the PID.vi is providing. Now all you need is a formula to reshape the values from PID to the motor. It's up to you to make such a formula. Unless you provide any details we cannot give more precise answers...
    Message Edited by GerdW on 02-28-2010 08:35 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How do I pragmmatic​ally determine what comm ports my serial instrument​s are on?

    I am building a test stand that incorporates 5 serial instruments; 2 digital loads and 3 power supplies. I can use my PC's device manager to figure out which comm port each device is on and set the VISA Resource Name so everything runs as expected. All is well at this point. The problem comes in when an instrument's USB connection is unplugged and replugged, at which point the system may renumber the port assignments; the result is that my program errors out, I have to figure out what port everything is on all over again, and change the VISA Resource Name for all of my instruments. While this is a minor annoyance for me as the developer, this would make the program unusable by the user.
    While "don't ever unplug an instrument" is a sensible answer, the fact is that these things happen from time to time - like for calibration - so I want the program to work regardless of instruments being unplugged.
    Is there a way to have the vi automatically identify what port each instrument is on?

    I've used a USB connected barcode scanner that appears as a COM port. If it is left connected to the same USB port the COM port remains constant but if it is disconnected and then put back into a different port the COM port changes. This sounds similar to your problem so I'll share how I solved things for my application.
    The scanner I use accepts commands and will respond with a known string when I send a character 'I' via the serial connection. Using this I can see if the scanner is connected to the expected COM port (default port is stored in an ini file).
    If this fails I create an array of possible serial ports by trying to open COM1 and checking for an error. If this does not generate an error I add it to an array. Next I try the same with COM2, COM3 up to COM16 (for example). This gives me a list of COM ports I can open.
    I then iterate through the array trying for a response and stopping either when I get the expected response and continuing with the application or if the device is not found by the time I get to the end of the array I show the appropriate error condition to the operator.
    If your instruments can return some kind of ID that will allow you to identify them as mentioned in another reply then this method could be used. Your 3 power supplies and 2 digital loads would need to be able to return a unique identifier otherwise you wouldn't be able to tell them apart and I think you'd possibly run in to problems.

Maybe you are looking for