Unix/Linux Go Back    


Android Brand new forum for folks interesting in Linux and Java-based Android OS and multi-platform mobile computing in general.

Device Names on Android

Android


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 10-21-2013   -   Original Discussion by fedora18
fedora18 fedora18 is offline
Registered User
 
Join Date: Sep 2013
Last Activity: 27 May 2015, 5:06 PM EDT
Posts: 60
Thanks: 3
Thanked 2 Times in 2 Posts
Device Names on Android

Hi,

I have a program that logs serial port data. In order to do so it requires the full device name in linux (e.g. /dev/ttyUSB0) and a baudrate.

Does anyone know how I can find out the device name in the terminal? I am trying to port this application to Android and cant figure it out.

#lsusb shows the device but with no path
#mount only shows its mount point

Any help is great
thakns
Sponsored Links
    #2  
Old Unix and Linux 10-21-2013   -   Original Discussion by fedora18
Corona688 Corona688 is online now Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 20 November 2017, 10:39 AM EST
Location: Saskatchewan
Posts: 22,514
Thanks: 1,153
Thanked 4,273 Times in 3,946 Posts
I suppose ls /dev is out of the question?

Android is nontraditional Linux/UNIX in many ways, I'm not sure it has a proper /dev.
Sponsored Links
    #3  
Old Unix and Linux 10-22-2013   -   Original Discussion by fedora18
fedora18 fedora18 is offline
Registered User
 
Join Date: Sep 2013
Last Activity: 27 May 2015, 5:06 PM EDT
Posts: 60
Thanks: 3
Thanked 2 Times in 2 Posts
Ya I know what you mean by non-traditional for sure. With Busybox though I do have access to a lot of UNIX commands which is very helpfull. On the Android tablet this is what I am getting under /dev:


Code:
auditpipe		ptyp7			ptyra			ptytd			ptyw0			ttyp5			ttyr8			ttyt8			ttyvb
autofs			ptyp8			ptyrb			ptyte			ptyw1			ttyp6			ttyr9			ttyt9			ttyvc
autofs_control		ptyp9			ptyrc			ptytf			ptyw2			ttyp7			ttyra			ttyta			ttyvd
autofs_nowait		ptypa			ptyrd			ptyu0			ptyw3			ttyp8			ttyrb			ttytb			ttyve
bpf0			ptypb			ptyre			ptyu1			ptyw4			ttyp9			ttyrc			ttytc			ttyvf
bpf1			ptypc			ptyrf			ptyu2			ptyw5			ttypa			ttyrd			ttytd			ttyw0
bpf2			ptypd			ptys0			ptyu3			ptyw6			ttypb			ttyre			ttyte			ttyw1
bpf3			ptype			ptys1			ptyu4			ptyw7			ttypc			ttyrf			ttytf			ttyw2
console			ptypf			ptys2			ptyu5			ptyw8			ttypd			ttys0			ttyu0			ttyw3
cu.Bluetooth-Modem	ptyq0			ptys3			ptyu6			ptyw9			ttype			ttys000			ttyu1			ttyw4
cu.Bluetooth-PDA-Sync	ptyq1			ptys4			ptyu7			ptywa			ttypf			ttys001			ttyu2			ttyw5
disk0			ptyq2			ptys5			ptyu8			ptywb			ttyq0			ttys002			ttyu3			ttyw6
disk0s1			ptyq3			ptys6			ptyu9			ptywc			ttyq1			ttys1			ttyu4			ttyw7
disk0s2			ptyq4			ptys7			ptyua			ptywd			ttyq2			ttys2			ttyu5			ttyw8
disk1			ptyq5			ptys8			ptyub			ptywe			ttyq3			ttys3			ttyu6			ttyw9
disk2			ptyq6			ptys9			ptyuc			ptywf			ttyq4			ttys4			ttyu7			ttywa
dtrace			ptyq7			ptysa			ptyud			random			ttyq5			ttys5			ttyu8			ttywb
dtracehelper		ptyq8			ptysb			ptyue			rdisk0			ttyq6			ttys6			ttyu9			ttywc
fbt			ptyq9			ptysc			ptyuf			rdisk0s1		ttyq7			ttys7			ttyua			ttywd
fd			ptyqa			ptysd			ptyv0			rdisk0s2		ttyq8			ttys8			ttyub			ttywe
fsevents		ptyqb			ptyse			ptyv1			rdisk1			ttyq9			ttys9			ttyuc			ttywf
klog			ptyqc			ptysf			ptyv2			rdisk2			ttyqa			ttysa			ttyud			urandom
lockstat		ptyqd			ptyt0			ptyv3			sdt			ttyqb			ttysb			ttyue			vboxdrv
machtrace		ptyqe			ptyt1			ptyv4			stderr			ttyqc			ttysc			ttyuf			vboxnetctl
null			ptyqf			ptyt2			ptyv5			stdin			ttyqd			ttysd			ttyv0			vn0
pmCPUClient		ptyr0			ptyt3			ptyv6			stdout			ttyqe			ttyse			ttyv1			vn1
profile			ptyr1			ptyt4			ptyv7			systrace		ttyqf			ttysf			ttyv2			vn2
ptmx			ptyr2			ptyt5			ptyv8			tty			ttyr0			ttyt0			ttyv3			vn3
ptyp0			ptyr3			ptyt6			ptyv9			tty.Bluetooth-Modem	ttyr1			ttyt1			ttyv4			zero
ptyp1			ptyr4			ptyt7			ptyva			tty.Bluetooth-PDA-Sync	ttyr2			ttyt2			ttyv5
ptyp2			ptyr5			ptyt8			ptyvb			ttyp0			ttyr3			ttyt3			ttyv6
ptyp3			ptyr6			ptyt9			ptyvc			ttyp1			ttyr4			ttyt4			ttyv7
ptyp4			ptyr7			ptyta			ptyvd			ttyp2			ttyr5			ttyt5			ttyv8
ptyp5			ptyr8			ptytb			ptyve			ttyp3			ttyr6			ttyt6			ttyv9
ptyp6			ptyr9			ptytc			ptyvf			ttyp4			ttyr7			ttyt7			ttyva

sorry for the long output!
THere are a ton of TTY device names but I am not sure what all of them are for. I also don't see any USB.
Ill keep looking into it. I don't see any reason why my simple serial port logger that works flawlessly on any Linux machine so far can't be setup to work on Android.
A last note: when i try random device names the application does seem to find the name and connect....however while listening (I used the C library's select() statement) it is not getting anything coming in.

Cheers

---------- Post updated at 09:32 AM ---------- Previous update was at 09:25 AM ----------

OH NO my mistake. that was for my desktop. /dev from the device yields:


Code:
ace_dev
alarm
android_adb
ashmem
autofs
aw_i2c_ts2
binder
block
bus
cachefiles
cedar_dev
console
cpu_dma_latency
cpuctl
cuse
device-mapper
disp
ecompass_ctrl
full
fuse
g2d
graphics
i2c-0
i2c-1
i2c-2
input
kmsg
lcd
log
mali
mem
mtp_usb
mxc622x
network_latency
network_throughput
null
pa_dev
ppp
ptmx
pts
random
rfkill
rtc0
snd
socket
tty
tty0
tty1
tty10
tty11
tty12
tty13
tty14
tty15
tty16
tty17
tty18
tty19
tty2
tty20
tty21
tty22
tty23
tty24
tty25
tty26
tty27
tty28
tty29
tty3
tty30
tty31
tty32
tty33
tty34
tty35
tty36
tty37
tty38
tty39
tty4
tty40
tty41
tty42
tty43
tty44
tty45
tty46
tty47
tty48
tty49
tty5
tty50
tty51
tty52
tty53
tty54
tty55
tty56
tty57
tty58
tty59
tty6
tty60
tty61
tty62
tty63
tty7
tty8
tty9
ttyGS0
ttyGS1
ttyGS2
ttyGS3
ttyS0
ttyS1
ttyS2
ttyS3
ttyS4
ttyS5
ttyS6
ttyS7
tun
uinput
ump
urandom
usb
usb_accessory
vcs
vcs1
vcsa
vcsa1
video1
xt_qtaguid
zero

many sorries
Moderator's Comments:
Device Names on Android Please use CODE tags; not ICODE tags for multi-line data and code samples.

Last edited by Don Cragun; 10-22-2013 at 02:37 PM.. Reason: Change ICODE tags to CODE tags.
    #4  
Old Unix and Linux 10-22-2013   -   Original Discussion by fedora18
Corona688 Corona688 is online now Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 20 November 2017, 10:39 AM EST
Location: Saskatchewan
Posts: 22,514
Thanks: 1,153
Thanked 4,273 Times in 3,946 Posts
Ugh... it looks like they just made every possible device without bothering to wonder which are actually present. Is tty.Bluetooth-Modem a symlink? Look for devices which are symlinks.
Sponsored Links
    #5  
Old Unix and Linux 10-22-2013   -   Original Discussion by fedora18
RudiC RudiC is online now Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 20 November 2017, 10:37 AM EST
Location: Aachen, Germany
Posts: 11,628
Thanks: 320
Thanked 3,617 Times in 3,322 Posts
Can you insert some USB device an check which entry is used/modified? Check the syslog as well.
Sponsored Links
    #6  
Old Unix and Linux 10-22-2013   -   Original Discussion by fedora18
fedora18 fedora18 is offline
Registered User
 
Join Date: Sep 2013
Last Activity: 27 May 2015, 5:06 PM EDT
Posts: 60
Thanks: 3
Thanked 2 Times in 2 Posts
ya..not pretty.
I am using a serial to USB converter with hardware by Prolific. It is the pl2303 one.
when i call up lsmod on my Linux laptop that runs the application fine I see a module called: usbserial pl2303
when I call up lsmod on the android I don't see it which makes sense.

I am assuming this may be the reason why #lsusb returns seeing the device but /dev/ttyUSB0 doesnt get populated upon attaching the device.

I think my plan of attack is to find out how to get that module on there......thoughts?

---------- Post updated at 03:10 PM ---------- Previous update was at 03:07 PM ----------

Rudy, the system log outputs this when my device gets attached:


Code:
D/ViewRootImpl( 1579): pckname = com.prolific.pl2303hxdsimpletest
I/USB3G   (   92): event { 'add', '/devices/platform/sw-ohci.1/usb3/3-1', 'usb', '', 189, 266 }
I/USB3G   (   92): path : '/sys/devices/platform/sw-ohci.1/usb3/3-1'
I/USB3G   (   92): VID :size 5,vid_path '/sys/devices/platform/sw-ohci.1/usb3/3-1/idVendor',VID  '067b
I/USB3G   (   92): '.
I/USB3G   (   92): PID :size 5,Pid_path '/sys/devices/platform/sw-ohci.1/usb3/3-1/idProduct',PID  '2303
I/USB3G   (   92): '.
I/USB3G   (   92): cmd=/system/bin/usb_modeswitch.sh /system/etc/usb_modeswitch.d/067b_2303 &,
I/ActivityManager(  156): START {act=android.hardware.usb.action.USB_DEVICE_ATTACHED flg=0x10000000 cmp=com.prolific.pl2303hxdsimpletest/.PL2303HXDSimpleTest (has extras)} from pid 156
D/PL2303HXD_APLog( 1579): Enter onStart
D/PL2303HXD_APLog( 1579): Leave onStart
D/PL2303HXD_APLog( 1579): Enter onResume
D/PL2303HXD_APLog( 1579): onResume:android.hardware.usb.action.USB_DEVICE_ATTACHED
D/PL2303HXD_APLog( 1579): New instance : tw.com.prolific.driver.pl2303.PL2303Driver@4107dcc8
I/PL2303HXDDriver( 1579): enumerating
I/USB3G   (   92): excute ret : 0,err:No such file or directory
I/PL2303HXDDriver( 1579): Found device: 0BDA:8179
I/PL2303HXDDriver( 1579): iSupportedDevListCnt: 5
I/PL2303HXDDriver( 1579): Found device: 067B:2303
I/PL2303HXDDriver( 1579): iSupportedDevListCnt: 5
D/PL2303HXDDriver( 1579): cmd:toolbox ls /dev/bus/usb/003/011
V/su-binary( 1905): ----su-----
V/su-binary( 1905): argv[1]=-c
V/su-binary( 1905): argv[2]=chmod 666 /dev/bus/usb/*/*
D/PL2303HXDDriver( 1579): verify: /dev/bus/usb/003/011
D/PL2303HXD_APLog( 1579): onResume:enumerate succeeded!
D/PL2303HXD_APLog( 1579): Leave onResume
D/ViewRootImpl( 1579): pckname = com.prolific.pl2303hxdsimpletest
D/PL2303HXDDriver( 1579): UARTintf index = 0
D/PL2303HXDDriver( 1579): Found UsbInterface[mId=0,mClass=255,mSubclass=0,mProtocol=0,mEndpoints=[Landroid.os.Parcelable;@4108d9f0]
D/PL2303HXDDriver( 1579): claim interface succeeded
I/PL2303HXDDriver( 1579): EP: 0x81
I/PL2303HXDDriver( 1579): EP: 0x02
I/PL2303HXDDriver( 1579): Bulk Endpoint
I/PL2303HXDDriver( 1579): EP: 0x83
I/PL2303HXDDriver( 1579): Bulk Endpoint
I/PL2303HXDDriver( 1579): setPLEndpoints succeeded
D/PL2303HXD_APLog( 1579): Enter onStop
D/PL2303HXD_APLog( 1579): Leave onStop

Sponsored Links
    #7  
Old Unix and Linux 10-22-2013   -   Original Discussion by fedora18
Corona688 Corona688 is online now Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 20 November 2017, 10:39 AM EST
Location: Saskatchewan
Posts: 22,514
Thanks: 1,153
Thanked 4,273 Times in 3,946 Posts
One thought: Just because lsusb shows it, does not mean your system has a driver for it. It recognizes by device serial numbers, of which lsusb has its own independent list. (much like lspci.)

If you can find it in /sys/ though, /sys/ can tell you the major and minor numbers of the device:


Code:
$ cat /sys/block/sdc/dev
8:32

$ ls -l /dev
...
brw-rw---- 1 root disk    8,  32 Oct  1 13:30 sdc
...

$

Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unable To Activate Ethernet Network Device in RHEL 5.5 - e100 device eth0 does not seem to be presen Tanmoy Red Hat 0 02-06-2013 05:06 PM
Android Scripting Environment: Shell Scripting and Android Neo Android 0 01-03-2011 04:10 PM
Device Files names and location Carl1976 UNIX for Dummies Questions & Answers 7 12-03-2008 04:57 AM



All times are GMT -4. The time now is 11:44 AM.