Problem closing non-responsive USB-serial ports

Phil Davis revdev at
Mon Mar 10 21:42:57 EDT 2008

Hi Sarah,

Is it OK in your case to ask the OS to intervene? If so, would something 
like this work?

on mouseUp
  unmountVolume (the selectedText of fld 1)
  put the result
end mouseUp

on unmountVolume pVolumeName
  put shell("diskutil list") into tList
  filter tList with ("* " & pVolumeName & " *")
  put last word of tList into tDisk
  put shell("diskutil unmount" && tDisk) into tResult
  return tResult
end unmountVolume

Sarah Reichelt wrote:
> Hi All,
> I am having a weird problem that may actually be faulty hardware, but
> I think Rev should be handling it better anyway. I have an app that
> communicates with a serial device via a USB-serial adapter. This works
> very well most of the time, but on one particular computer, the USB
> ports drop out every now & then. I have scripts that detect when the
> serial device is not responding, they try again once and then they try
> resetting the port by closing it & re-opening it. However it never
> gets past the closing of the port.
> This is on OS X and I use the "close driver" command, with the driver
> name that was stored when the port was opened. It is enclosed in a
> "try" structure and it never gives an error, but never completes. It
> then takes numerous force-quits to get rid of the app and a full
> restart is needed to get the communications working again.
> So I may have a computer with a dodgy USB bus, but surely I should be
> getting an error message rather than just hanging. I tried sending a
> timed message before starting to close the port, but this never
> happens either, so Rev really gets completely stuck trying to close a
> non-responsive serial port.
> Has anyone experienced anything similar? Is it worth a bug report? And
> do any of you have any suggestions as to what I could try next apart
> from switching this app to another computer which I plan to do next
> week).
> TIA,
> Sarah
Phil Davis

PDS Labs
Professional Software Development

More information about the Use-livecode mailing list