It is currently Sat Jan 19, 2019 1:10 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Re: OSX, PB & USB-RS232 serial ports
PostPosted: Fri Sep 17, 2010 7:37 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Aug 21, 2007 2:44 pm
Posts: 430
Location: USA (Cincinnati)
I've had a chance to test this and...
Code:
If ExamineDirectory(0,"/dev/","tty.u*")
  While NextDirectoryEntry(0)
    If DirectoryEntryType(0) = #PB_DirectoryEntry_File
      MessageRequester("/dev/filename", DirectoryEntryName(0))
    EndIf
  Wend
  FinishDirectory(0)
EndIf
finds the three USB-Serial adapters I have connected. I will be modifying my Linux procedure accordingly as this is much simpler.


Top
 Profile  
Reply with quote  
 Post subject: Re: OSX, PB & USB-RS232 serial ports
PostPosted: Fri Oct 08, 2010 4:45 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Aug 21, 2007 2:44 pm
Posts: 430
Location: USA (Cincinnati)
The code snippet below finds all the serial ports on my Intel mini but fails on my PPC iMac. I suspect I need to search a different directory(?) and/or use different search patterns. So far, I haven't figured out how to find, let alone view the contents, of /dev.
Code:
  OpenPreferences(AppPath+"user.prf"):PreferenceGroup("user")
    ports = ReadPreferenceString("ports","NONE")   
    dirs = ReadPreferenceString("dirs","")    ; dirs = /dev
    patterns = ReadPreferenceString("patterns","")   ;patterns = tty.u*
  ClosePreferences()
  If ports="NONE"
    ports=""
    Protected i,j,dir.s,pattern.s
    NewList Comports.s()
    For i=1 To CountString(dirs,",")+1
      dir=StringField(dirs,i,",")
      For j=1 To CountString(patterns,",")+1
        pattern=StringField(patterns,j,",")
        If ExamineDirectory(0,dir,pattern)
          ;MessageRequester(dir,pattern)
          While NextDirectoryEntry(0)
            If DirectoryEntryType(0) = #PB_DirectoryEntry_File
              AddElement(ComPorts())
              ComPorts()=dir+"/"+DirectoryEntryName(0)             
            EndIf
          Wend
          FinishDirectory(0)
        EndIf 
      Next j
    Next i 
    SortList(ComPorts(),0)
    ForEach ComPorts()
      If FindString(ports,ComPorts(),1)=0               ;avoid duplicates
        If Len(ports):ports+",":EndIf
        ports+ComPorts()
      EndIf
    Next   
    ;MessageRequester("ports",ports)
  EndIf
EndProcedure

_________________
http://davehouston.org
Mac Mini (Intel) 10.6.8 - iMac G4 (PPC) 10.4.11
Dell Dimension 2400 W98SE,W2K,XP,Vista,W7,Debian,Ubuntu,Kubuntu,Xubuntu,Fedora,Mandriva,Mint
(on swappable HDDs)
Vizio VTAB1008 - Android 3.1
MK808 miniAndroidPC (Android 4.1)


Top
 Profile  
Reply with quote  
 Post subject: Re: OSX, PB & USB-RS232 serial ports
PostPosted: Fri Oct 08, 2010 7:16 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Aug 21, 2007 2:44 pm
Posts: 430
Location: USA (Cincinnati)
I had overlooked the need for drivers. Both of my test serial-USB adapters (one FTDI based, one Prolific based) showed up in System Profiler but I guess it took the installation of the drivers to actually create the /dev entries.

_________________
http://davehouston.org
Mac Mini (Intel) 10.6.8 - iMac G4 (PPC) 10.4.11
Dell Dimension 2400 W98SE,W2K,XP,Vista,W7,Debian,Ubuntu,Kubuntu,Xubuntu,Fedora,Mandriva,Mint
(on swappable HDDs)
Vizio VTAB1008 - Android 3.1
MK808 miniAndroidPC (Android 4.1)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye