Device Names on Android


 
Thread Tools Search this Thread
Operating Systems Linux Android Device Names on Android
# 1  
Old 10-21-2013
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
# 2  
Old 10-21-2013
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.
# 3  
Old 10-22-2013
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:
Mod Comment 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 10-22-2013
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.
# 5  
Old 10-22-2013
Can you insert some USB device an check which entry is used/modified? Check the syslog as well.
# 6  
Old 10-22-2013
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

# 7  
Old 10-22-2013
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
...

$

Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Android Device ID Changer shell script

this is worked "ANDROID NOUGAT" how can i use it for "ANDROID OREO" -plz help me... ------------------------------------------- echo " Ã-~-DEVICE ID CHANGINGÃ-~-" sleep 2 echo " " COUNT=1 while do ; echo "settings put secure android_id " | tr -d '\n' > X1... (4 Replies)
Discussion started by: f4is4l
4 Replies

2. HP-UX

Failed to open tape device /dev/rmt/0mn:Device busy (errno = 16)

Hi, Unable to make tape backup, please help. /opt/ignite/bin/make_tape_recovery -a /dev/rmt/?mn -I -v -m tar -x inc_entire=vg00 * Creating local directories for configuration files and archive. ======= 04/25/16 16:28:08 IST Started /opt/ignite/bin/make_tape_recovery. (Mon... (4 Replies)
Discussion started by: anuragr
4 Replies

3. Android

Running only the Linux kernel of an Android device

I am looking for a way to run on top of the Linux kernel of an Android device. I want to use the existing configured Linux beneath Android rather than put a new Linux distribution onto a device. The article "The Android boot process from power on" (sorry, forum won't let me paste the link)... (0 Replies)
Discussion started by: raoulney
0 Replies

4. Red Hat

Unable To Activate Ethernet Network Device in RHEL 5.5 - e100 device eth0 does not seem to be presen

Hi All, Could anyone please help to resolve the below problem. I installed RHEL5.5 in my desktop.But when i try to activate the ethernet connection then it gives me the error. I spent 2 days for the above and go through with several suggestion found by googling. But no luck. ... (0 Replies)
Discussion started by: Tanmoy
0 Replies

5. Android

Android Scripting Environment: Shell Scripting and Android

I just upgraded to Android 2.2 from 2.1. The GPS issue that was troublesome in 2.1 seems to have been fixed. Some of web browsing seems faster, but it could just be my connection is better today ;) Flash works in some browsers but not very good and it is too slow for Flash apps designed for... (0 Replies)
Discussion started by: Neo
0 Replies

6. UNIX for Dummies Questions & Answers

Device Files names and location

HI there. I am studying System administration right now and am stuck on a question that I have failed to find the answer for in my book. The question is: Do device files need to be in the /dev directory and to they need to follow a naming convention? My answer (so far) is that since the... (7 Replies)
Discussion started by: Carl1976
7 Replies
Login or Register to Ask a Question