Addressing Hardware - particularly usb port

Phil Davis revdev at
Thu Feb 12 16:36:57 EST 2009

Hey Peter,

Is your device listed in the output of this function? If so, try opening 
it and writing a command to it.

function myDeviceNames
  # Handler courtesy of Ken Ray & Dar Scott
  local theNames="", ioregOutput, skipLines, temp
  local IOTTYDevice, IODialinDevice, IOCalloutDevice
  set the hideConsoleWindows to true
  put shell("ioreg -n IOSerialBSDClient") into ioregOutput
  repeat forever
    put lineOffset("IOSerialBSDCLient",ioregOutput) into skipLines
    if skipLines is zero then return thenames
    delete line 1 to skipLines of ioregOutput
    -- Get all the data between the braces
    put char(offset("{",ioregOutput)) to (offset("}",ioregOutput)) of 
ioregOutput into temp
    get matchText(temp,"\"IOTTYDevice\" = \"(.*?)\"",IOTTYDevice)
    if it is not true then next repeat
    get matchText(temp,"\"IODialinDevice\" = \"(.*?)\"",IODialinDevice)
    if it is not true then next repeat
    get matchText(temp,"\"IOCalloutDevice\" = \"(.*?)\"",IOCalloutDevice)
    if it is not true then next repeat
    put IOTTYDevice,IODialinDevice,IOCalloutDevice & lineFeed after theNames
  end repeat
end myDeviceNames

Phil Davis

Peter Alcibiades wrote:
> Thanks everyone!  Its Linux, the OS that is being used.
> Sarah's article is interesting, but my problem is that the device is USB. 
> So a serial to USB adaptor won't do it - it will allow use of a serial
> device on a usb port.  If anything what I'd need would go the other way -
> allow use of a usb device on a serial port.
> One other suggestion is to make one of the usb ports into a virtual serial
> port.  Yes, maybe.  Again, not something I've ever gone near, but will
> probably try it before this is over!  Apparently you can map them...

Phil Davis

PDS Labs
Professional Software Development

More information about the Use-livecode mailing list