Communication with USB HID devices?

Dar Scott dsc at swcp.com
Fri Jul 9 17:53:58 EDT 2004


On Jul 9, 2004, at 3:43 PM, Phil Davis wrote:

> The docs suggest that on OSX/Unix I should be able to find device 
> names in
> the "/dev/tty" file. That file is empty on my machine - the device 
> isn't
> listed there, maybe? because it doesn't have a custom driver.
>
> Try again!

Look for /dev/tty*.  For example the built-in modem is shown as 
/dev/tty.modem.

Look for /dev/cu*.  Those are the one you will use.

I was going to suggest something else and based on what you are saying, 
it may work out.  Many devices have (sometimes in addition to other 
interfaces) a interface that looks like a serial device.

Sometimes driverNames() will miss devices.  Try this:


-- Ken Ray and Dar Scott did this
function deviceNames
   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 deviceNames

For example, this will find my internal modem.

Dar Scott



More information about the use-livecode mailing list