LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 03-13-2016, 01:23 AM   #1
jimmy2447
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Rep: Reputation: Disabled
Question How to know the Port name of a Serial port using its directory?


hello guys.
I was working with a java project which will read from serial port of my laptop like USB.
So, i know the directory of my serial usb is that dev/ttyUSB0
but it is not working with my java program but when i use minicom -s
it starts reading the values.
The problem is that my java program only accepts the name of the serial ports like COM0,COM10,COM22 etc.
when i run this java program on windows it works fine.
now i want to find the port name of the directory dev/ttyUSB0

Does anyone can help me on this? it will be very thankful.
 
Old 03-13-2016, 01:48 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,924

Rep: Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319
that is /dev/ttyUSB0, probably you only missed the / at the beginning. Without knowing anything about your java code we can hardly tell you the solution.
 
Old 03-13-2016, 07:01 AM   #3
jimmy2447
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Original Poster
Rep: Reputation: Disabled
first thank u for reply.
I used that '/' too at the beginning.. thats not the problem.
like whenever we connect a device to windows, it automatically provide the name to that connection like COM0,COM22,COM10 etc
I am asking that how to know that name in linux ?
well you dont need any information about java.
 
Old 03-13-2016, 09:13 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,924

Rep: Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319
probably /dev/ttyS0, /dev/ttyS1 .... http://www.tldp.org/HOWTO/Serial-HOWTO-10.html
 
Old 03-13-2016, 10:40 AM   #5
jimmy2447
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Original Poster
Rep: Reputation: Disabled
okeh thank u sir..
the problem is that linux dont use the port names as COM0,COM30,COM21 etc
but linux store the usb names as /dev/ttyUSB0 or /dev/ttyUSB1 etc
there maybe problem with java program it do not know what a /dev/ttyUSB0/1/2 is.
i dont know but it works fine in windows.
I suggest java is a worst language. C is best among all.
 
Old 03-13-2016, 11:06 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,924

Rep: Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319Reputation: 7319
have you tried /dev/ttyS0 or /dev/ttyS1 or ... ?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is a USBtty (USB serial port) treated the same as tty (normal serial port) in C? spudgunner Programming 1 11-12-2010 01:19 PM
linux serial port to router console port connection? frankie_fix Linux - General 3 02-26-2007 09:32 PM
Parallel Port & Serial Port device identification helpmeforlinux Linux - Hardware 3 01-02-2007 01:15 AM
IBM AIX 5.2/5.3 serial port/tty0 port vinod_balani AIX 2 02-19-2006 03:38 PM
Using serial port card(PCMCIA) with IPAQ running Linux, can't find ttyS0 port d2army Linux - Laptop and Netbook 0 11-12-2005 08:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration