[CM9.0.0][Siyah v4.1rc1+] Prolific/FTDI Serial Terminal HowTo - Galaxy S II General

[CM9.0.0][Siyah v4.1rc1+] Prolific/FTDI Serial Terminal HowTo
Hi everybody out there!
I just finally managed to use my Galaxy S2 as a serial terminal for my newly bought cubox (google for solid-run)
and as I found very little information on how to achieve that, I thought about telling the word to other folks like me.
As I am definitely not experienced with compiling kernels and stuff, I used a precompiled kernel and rom:
Siyah Kernel: Siyah-s2-v4.1rc1-CWM.zip
Cyanogenmod: cm-9.0.0-galaxys2.zip
I also installed Busybox from BusyBox Pro by Stephen (Stericson) which contains the tool microcom
Now I use Irssi Connectbot, open a session and enter the following commands:
For becoming root: su
Needed first: insmod /lib/modules/usbserial.ko
If I want the Prolific Adapter: insmod /lib/modules/pl2303.ko
If I want the FTDI Adapter: insmod /lib/modules/ftdi_sio.ko
Now I check, if the modules have been loaded: lsmod
That gives me the following:
dhd 399255 0 - Live 0xbf04e000
ftdi_sio 27902 0 - Live 0xbf044000
pl2303 11895 0 - Live 0xbf03e000
usbserial 24441 2 ftdi_sio,pl2303, Live 0xbf034000
j4fs 68207 1 - Live 0xbf00a000 (P)
Si4709_driver 24227 0 - Live 0xbf000000
ftdi_sio ... Live ... <- FTDI Module loaded
pl2303 ... Live ... <- Prolific Module loaded
Now I plug my Usb2Microusb cable into my device and my OTG Adapter and finally into my Galaxy S2
Because me OTG Adapter was a very cheap one,
I need to check if it is actually connected:
dmesg | grep usb
...
<6>[53402.191025] usb 2-1: Manufacturer: Prolific Technology Inc.
<6>[53402.237498] usb 2-1: pl2303 converter now attached to ttyUSB0
I now have a ttyUSB0 in /dev , which I can use with microcom:
microcom -s 115200 /dev/ttyUSB0
et voilà, im using a serial terminal connection to my device.
When I'm finished, I close microcom with Ctrl-x.
( I actually need to push the onscreen Ctrl in Connectbot and then press x on my touchscreen keyboard)
Now I unplug the OTG Adapter and unload the loaded modules with rmmod:
rmod pl2303
rmmod ftdi_sio
rmmod usbserial
Thats all. No more Bulky Laptops for Serial connections in cramped places!
PS: Thats my 1st post on this site and about my 10th post in forums in my lifetime.
So yeah, Im a "noob" in forumposting and a not so perfect english speaker.
Please feel free to correct and guide me

Thanks for the post. You can also create a script for faster execution.
Does it necessary to unload the modules after use?
Sent from my GT-I9100 using xda app-developers app

What do I have to do to get this working on rooted Xperia Z? I do not see any /lib folder in root.

Related

G1 on linux gentoo

Hi,all.
my system:
uname -a
Linux localhost 2.6.28-gentoo-r1
Click to expand...
Click to collapse
when my g-phone is connected
I get the message from dmesg
dmesg
[ 4648.550324] usb 2-6: New USB device found, idVendor=0bb4, idProduct=0c02
[ 4648.550326] usb 2-6: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 4648.550328] usb 2-6: Product: Android Phone
[ 4648.550330] usb 2-6: Manufacturer: HTC
[ 4648.550331] usb 2-6: SerialNumber: HT848GZ72398
[ 4648.550336] hub 2-0:1.0: state 7 ports 10 chg 0000 evt 0040
Click to expand...
Click to collapse
then on g1 screen i choose "mount sd-card"
but KDE4.2.0 does not detect flash-card.
On windowsXP g1 as flashcard is working normally.
Ubuntu 8.04 \8.10 working norm too.
I think that the case in the kernel.
anyone can help with kernel .config?
You'd probably get better help on this from a Gentoo user forum, especially since you say it works fine under Kubuntu (as it does for me as well.)
I'd imagine it's a matter of hal configuration rather than the kernel. Search (on Google) for tips on enabling hal polling in Gentoo.
Do you have usb_storage loaded or enabled in your kernel? I don't see anything in your dmesg output about assigning your G1 to a device (/dev/sd#). Also - make sure you check the dmesg output AFTER you enable mounting the drive on the G1 - it won't present a USB storage device to gentoo until after this happens, so there might be additional output. If you do get additional output please post it here.
Do other USB drives work?
Try:
zcat /proc/config.gz | grep CONFIG_USB_STORAGE
If that doesn't work, try:
zcat /usr/src/linux/.config | grep CONFIG_USB_STORAGE
Make sure CONFIG_USB_STORAGE is set to "y" or "m". If not you'll need to rebuild your kernel. I'm sure a default kernel is going to include it - if you don't have it on then you most likely already know how to fix that.
I have to confess that I don't really use kde automounting much - I prefer the command line (especially since half the time I have more than one kde session open and I get all kinds of issues with dialog boxes opening up on a session I'm not looking at when I add a new device).
is hald service started?
Code:
/etc/init.d/hald status
if not, start it.
Code:
/etc/init.d/hald start
I have gentoo, and mounts fine (i use gnome).
For more help go to gentoo forums
rich0
zcat /proc/config.gz | grep CONFIG_USB_STORAGE
CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
# CONFIG_USB_STORAGE_FREECOM is not set
# CONFIG_USB_STORAGE_ISD200 is not set
# CONFIG_USB_STORAGE_DPCM is not set
# CONFIG_USB_STORAGE_USBAT is not set
# CONFIG_USB_STORAGE_SDDR09 is not set
# CONFIG_USB_STORAGE_SDDR55 is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set
# CONFIG_USB_STORAGE_ALAUDA is not set
# CONFIG_USB_STORAGE_ONETOUCH is not set
# CONFIG_USB_STORAGE_KARMA is not set
# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
Click to expand...
Click to collapse
enlightener
/etc/init.d/hald status
* status: started
Click to expand...
Click to collapse
Do other USB drives work?
yes,it work for my psp and flash-disks

CyanogenMod9 and AOKP for TF101G (NEW BUILD)

Working now. Check my rom
You mean you want to try if you can activate the 3G module?
I flashed it but it doesn't work. There isn't even the mobile data option. You know where you can change APNs etc.
I couldn't grab the adb output though. Adb doesn't see my TF I'll try again in the evening.
Sent from my Galaxy Nexus using XDA
Nebucatnetzer said:
I flashed it but it doesn't work. There isn't even the mobile data option. You know where you can change APNs etc.
I couldn't grab the adb output though. Adb doesn't see my TF I'll try again in the evening.
Sent from my Galaxy Nexus using XDA
Click to expand...
Click to collapse
You can also put "ls /dev" in Terminal Emulator and give me the output
Nebucatnetzer said:
I flashed it but it doesn't work. There isn't even the mobile data option. You know where you can change APNs etc.
I couldn't grab the adb output though. Adb doesn't see my TF I'll try again in the evening.
Sent from my Galaxy Nexus using XDA
Click to expand...
Click to collapse
1. Make sure you have usb debugging enabled on the transformer (this is often not the case on new installs)
2. try the naked drivers
Naked drivers: http://forum.xda-developers.com/showthread.php?t=1379875
You can also put "ls /dev" in Terminal Emulator and give me the output
Click to expand...
Click to collapse
Here you go.
Code:
[email protected]:/ $ export PATH=/data/local/bin:$PATH
[email protected]:/ $ ls /dev
accelirq
alarm
android_adb
ashmem
asusec
battery
binder
block
bus
compassirq
console
cpu_dma_latency
cpuctl
device-mapper
dsp_fm34
full
fuse
graphics
i2c-0
i2c-1
i2c-2
i2c-3
i2c-4
input
kmsg
knvmap
lightsensor
log
maXTouch
maXTouch_messages
max_online_cpus
mem
mi1040
mpu
mpuirq
mtp_usb
nct1008
network_latency
network_throughput
null
nvhdcp1
nvhost-ctrl
nvhost-display
nvhost-dsi
nvhost-gr2d
nvhost-gr3d
nvhost-isp
nvhost-mpe
nvhost-vi
nvmap
ov5640
port
ppp
ptmx
pts
random
rfkill
rtc0
snd
socket
tegra-crypto
tegra_avp
tegra_camera
tegra_dc0
tegra_dc1
tegra_mediaserver
tegra_rpc
tegra_sema
timerirq
touch_debug
touchpanel
tps6586x
tty
ttyHS1
ttyHS2
ttyHS3
ttyS0
ttyS1
ttyS2
ttyS3
ttyUSB0
ttyUSB1
ttyUSB2
ttyUSB3
ttyUSB4
ttyUSB5
tun
uinput
urandom
usb
usb_accessory
vga_arbiter
wm8903
xt_qtaguid
zero
[email protected]:/ $
do you have a public source tree for your work ?
Nebucatnetzer said:
Here you go.
Code:
[email protected]:/ $ export PATH=/data/local/bin:$PATH
[email protected]:/ $ ls /dev
accelirq
alarm
android_adb
ashmem
asusec
battery
binder
block
bus
compassirq
console
cpu_dma_latency
cpuctl
device-mapper
dsp_fm34
full
fuse
graphics
i2c-0
i2c-1
i2c-2
i2c-3
i2c-4
input
kmsg
knvmap
lightsensor
log
maXTouch
maXTouch_messages
max_online_cpus
mem
mi1040
mpu
mpuirq
mtp_usb
nct1008
network_latency
network_throughput
null
nvhdcp1
nvhost-ctrl
nvhost-display
nvhost-dsi
nvhost-gr2d
nvhost-gr3d
nvhost-isp
nvhost-mpe
nvhost-vi
nvmap
ov5640
port
ppp
ptmx
pts
random
rfkill
rtc0
snd
socket
tegra-crypto
tegra_avp
tegra_camera
tegra_dc0
tegra_dc1
tegra_mediaserver
tegra_rpc
tegra_sema
timerirq
touch_debug
touchpanel
tps6586x
tty
ttyHS1
ttyHS2
ttyHS3
ttyS0
ttyS1
ttyS2
ttyS3
ttyUSB0
ttyUSB1
ttyUSB2
ttyUSB3
ttyUSB4
ttyUSB5
tun
uinput
urandom
usb
usb_accessory
vga_arbiter
wm8903
xt_qtaguid
zero
[email protected]:/ $
Click to expand...
Click to collapse
Many thanks for that, now I can see kernel supports it, so it should be possible to integrate 3G
I'll fix the build later
Cool looking forward to this. Maybe it stops my TF from rebooting when it's unconnected to a power source.
Sent from my Galaxy Nexus using XDA
new build on the first post
still no public source ?
rhaaa said:
still no public source ?
Click to expand...
Click to collapse
I'll provide it when everything is working
It doesn't work. I can't save any APNs because there is no save button.
And if I want to choose the network operator it fails at the search.
Do you need any specific logs?
Nebucatnetzer said:
It doesn't work. I can't save any APNs because there is no save button.
And if I want to choose the network operator it fails at the search.
Do you need any specific logs?
Click to expand...
Click to collapse
A logcat would be nice, when you try to search for networks
ricardopvz said:
A logcat would be nice, when you try to search for networks
Click to expand...
Click to collapse
Et voilà
10 char

Connecting Android to a serial device using USB-Serial Converter

I am attempting to connect to a serial device from a Android tablet, via
USB-Serial Converter. In order to interface with this particular serial
device, a linux library must be used as an interface.
This library takes an integer as an argument, and tries to connect to the
device at the following location : /dev/ttySx, where x is the arguement. If
2 is provided to the library, it will look for the device at /dev/ttyS2.
Very simple.
When I connect the device to Ubuntu, there's is one simple extra step for
this device to work with the USB-Serial convert. The converter is exposed
at the location /dev/ttyUSB1. I just need to create a simple soft-link with
the serial port pattern (etc "ln -s /dev/ttyUSV1 /dev/ttyS99"). It works
perfectly.
Now the problem arises for Android. The converter is seen at
/dev/bus/usb/01/01. I never seen this convention in other project. The
question is how can I direct the I/O from /dev/ttySX to /dev/bus/usb/01/01
ehpaul said:
I am attempting to connect to a serial device from a Android tablet, via
USB-Serial Converter. In order to interface with this particular serial
device, a linux library must be used as an interface.
This library takes an integer as an argument, and tries to connect to the
device at the following location : /dev/ttySx, where x is the arguement. If
2 is provided to the library, it will look for the device at /dev/ttyS2.
Very simple.
When I connect the device to Ubuntu, there's is one simple extra step for
this device to work with the USB-Serial convert. The converter is exposed
at the location /dev/ttyUSB1. I just need to create a simple soft-link with
the serial port pattern (etc "ln -s /dev/ttyUSV1 /dev/ttyS99"). It works
perfectly.
Now the problem arises for Android. The converter is seen at
/dev/bus/usb/01/01. I never seen this convention in other project. The
question is how can I direct the I/O from /dev/ttySX to /dev/bus/usb/01/01
Click to expand...
Click to collapse
Which android device are you using and with which kernel and android build? In my case I am using kernel 3.0.+ with CM9 on a Kindle Fire and I do see the /dev/ttyUSBx getting created along with the /dev/bus/01/01. It has been a month since I tried it but I was able to see the problem you see and here is what I remember. When you plug the serial convertor both /dev get created but since the Android USB support only uses /dev/bus/usb/01/01, the kernel in order to save power "unmounts" the unused /dev/ttyUSBx after a certain time period. You can try using dmesg to see if that is happening in your case also. There is a kernel build flag that tells the kernel not to "unmount" it but I dont remember it off-hand. Best would be to use the Android USB support to talk to your device instead of the linux library if you can.
--------Update after testing it out again and checking dmesg etc---------------------------
When I plug the FTDI cable this is what shows up in dmesg:
<6>usb 1-1: new full speed USB device number 8 using musb-hdrc
<3>usb 1-1: device v0403 p6001 is not supported
<6>ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
<6>usb 1-1: Detected FT232RL
<6>usb 1-1: Number of endpoints 2
<6>usb 1-1: Endpoint 1 MaxPacketSize 64
<6>usb 1-1: Endpoint 2 MaxPacketSize 64
<6>usb 1-1: Setting MaxPacketSize 64
<6>usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0
At this point if I check the filesystem I see both /dev/ttyUSB0 and /dev/bus/usb/001/0xx [ xx being the current device number ]
I can work with /dev/ttyUSB0 and all is well. Now as soon as I invoke any app that uses Android USB Host Mode API to connect
to USB (for enumeration, connection or whatever) the /dev/ttyUSB0 gets disconnected with following message from dmesg:
<6>ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
<6>ftdi_sio 1-1:1.0: device disconnected
At this point /dev/bus/usb/001/0xx is still alive and if I enumerate the USB devices using android API I see the same as the adaptor
name. So looks like till the Android USB API takes over the FTDI is available as /dev/ttyUSB0 but not afterwards.
------------------------Update ends--------------------------------
(a) If you see a /dev/ttyUSB1 device node created, then you can try the following in an Android terminal:
Code:
stty -F /dev/ttyUSB1 raw
cat /dev/ttyUSB1
If this shows data from your device, then you can use directly the device node to read()/write(), POSIX-style, without needing any library.
(b) If you cannot see a /dev/ttyUSB1 in your Android device, this means that you need to load the ftdi_sio kernel module (check android.serverbox.ch/?p=285 for instructions).
Let me link that for you:
"How to enable FTDI Support for your USB Host featuring Honeycomb Tablet (including sample native application)"
Also have a look at FTDI's Android Paper:
"White Paper: Connecting Peripherals to an Android Platform"
and this relevant blog, from this XDA thread.
pankaj013 said:
Which android device are you using and with which kernel and android build? In my case I am using kernel 3.0.+ with CM9 on a Kindle Fire and I do see the /dev/ttyUSBx getting created along with the /dev/bus/01/01. It has been a month since I tried it but I was able to see the problem you see and here is what I remember. When you plug the serial convertor both /dev get created but since the Android USB support only uses /dev/bus/usb/01/01, the kernel in order to save power "unmounts" the unused /dev/ttyUSBx after a certain time period. You can try using dmesg to see if that is happening in your case also. There is a kernel build flag that tells the kernel not to "unmount" it but I dont remember it off-hand. Best would be to use the Android USB support to talk to your device instead of the linux library if you can.
--------Update after testing it out again and checking dmesg etc---------------------------
When I plug the FTDI cable this is what shows up in dmesg:
<6>usb 1-1: new full speed USB device number 8 using musb-hdrc
<3>usb 1-1: device v0403 p6001 is not supported
<6>ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
<6>usb 1-1: Detected FT232RL
<6>usb 1-1: Number of endpoints 2
<6>usb 1-1: Endpoint 1 MaxPacketSize 64
<6>usb 1-1: Endpoint 2 MaxPacketSize 64
<6>usb 1-1: Setting MaxPacketSize 64
<6>usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0
At this point if I check the filesystem I see both /dev/ttyUSB0 and /dev/bus/usb/001/0xx [ xx being the current device number ]
I can work with /dev/ttyUSB0 and all is well. Now as soon as I invoke any app that uses Android USB Host Mode API to connect
to USB (for enumeration, connection or whatever) the /dev/ttyUSB0 gets disconnected with following message from dmesg:
<6>ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
<6>ftdi_sio 1-1:1.0: device disconnected
At this point /dev/bus/usb/001/0xx is still alive and if I enumerate the USB devices using android API I see the same as the adaptor
name. So looks like till the Android USB API takes over the FTDI is available as /dev/ttyUSB0 but not afterwards.
------------------------Update ends--------------------------------
Click to expand...
Click to collapse
are you using ftdi's code to modify it?
change /system/etc/permissions
this is from a question on stackoverflow titled "Android USB host and hidden devices" (sorry, i can't add external URLs yet). it worked like a charm on a micromax A120 canvas 2 phone (kitkat 4.4.2). now i can control my Arduino! i used busybox tools to do all the command line work (otherwise chmod wouldn't work). my steps (perhaps some were not required):
(0) install PDAnet drivers on my Windows 8 computer.
(1) root the phone using Vroot (now called iRoot). Very simple, only catch is that the su grant/deny page is partly in chinese, no big deal.
(2) install busybox and jackpal's Android-Terminal-Emulator available on github and the google play store (free).
(3) open a terminal window and become the superuser:
# su
(4) the file system may be read-only, so you might have to remount it:
# mount -o rw,remount -t yaffs2 /
or
# mount -o rw,remount -t rootfs /
or
# mount -o rw,remount -t rootfs rootfs /system
(5) make default.prop read/write:
chmod 666 /default.prop
(6) edit /default.prop, make the following changes:
ro.secure=0
ro.debuggable=1
persist.service.adb.enable=1
... And this is the real meat of it:
(7) To enable USB host API support you should add a file named
android.hardware.usb.host.xml and containing the following lines:
<permissions>
<feature name="android.hardware.usb.host"/>
</permissions>
into folder
/system/etc/permissions
in that folder find file named
handheld_core_hardware.xml or tablet_core_hardware.xml
and add
<feature name="android.hardware.usb.host" />
into <permissions> section.
(8) Reboot your device. Usb host api should work.

[Q] USBOTG for Galaxy Y GT-S5360

This is my first thread/post in the forum, so I am not quite sure if this is the right place for this question. I recently happened to see a schematic diagram of the GT-S5360. I noticed that the main chipset includes support for USBOTG HS(480 Mbps).
http://forum.xda-developers.com/showthread.php?t=1489767
If this is indeed true, is there any way we can enable this feature in the GT-S5360? I mean, is there a custom ROM/Kernel which enables this feature?
Apologies if I have posted this in the wrong section.
If you have usb otg cable then try kuro and merruk kernel....
And search before posting
Sent from my GT-S5360 using xda premium
Hi, please look in the dev section. We already have 2-3 kernels which enable us to use this feature, if i'm not wrong.
Sent from my GT-S5360 using xda premium
that is a block diagram not schematic
alkesh95 said:
If you have usb otg cable then try kuro and merruk kernel....
And search before posting
Sent from my GT-S5360 using xda premium
Click to expand...
Click to collapse
Thanks for the response Alkesh, I will try those. I had infact searched for something similar in the forum but could not come up with any names - maybe I did something wrong. I found this though: http://forum.xda-developers.com/showthread.php?t=1493325
my kernel didn't support it
my kernel is based on samsung's sourcode. on other hand, our "beloved" samsung have messed up the source code. thus, make the OTG stuff on the kernel didn't work.
kurotsugi said:
my kernel didn't support it
my kernel is based on samsung's sourcode. on other hand, our "beloved" samsung have messed up the source code. thus, make the OTG stuff on the kernel didn't work.
Click to expand...
Click to collapse
Thanks for clarifying Kurotsugi. So is there any kernel which supports this feature currently? I searched the development forums - seems Merruk also doesnt support this feature currently, Maroc-OS is working on it as I understand from http://forum.xda-developers.com/showthread.php?t=1550065
xdroid_noob said:
Thanks for clarifying Kurotsugi. So is there any kernel which supports this feature currently? I searched the development forums - seems Merruk also doesnt support this feature currently, Maroc-OS is working on it as I understand from http://forum.xda-developers.com/showthread.php?t=1550065
Click to expand...
Click to collapse
if you have the cable you can try that.
ask samsung
works now
Hi guys.
Sorry for necroposting.
Also this post should probably go to development section, but I don't have access to post there (yet?).
First of all, BCM21553 seems to lack ID pin. ID pin from USB connector goes straight to PMU chip instead.
It is used to detect the type of the charger as far as I can tell.
It's not a big deal to extend PMU isr's to support OTG cable as a different type of charger (yes, external +5v source is required).
The real trick (for me) was to find a way to force DWC core into Host mode. Looks like Synopsis is no longer sharing datasheets with public.
Luckily Broadcom is not the only company which uses the same USB IP.
It looks like DWC driver was designed for an older kernel version.
It was partly ported by Samsung, but only as much as required to support the device mode.
It's still very flaky and fragile. For instance, it you try to cat /sys/devices/lm-2/mode, it will panic the stock kernel.
All HC code is non-functional and does not even build out of the box.
It took me almost a week to fix all the bugs and to be able to build standalone dwc_otg.ko with working HC code.
At the moment I managed to successfully mount a memory stick on my phone. Device mode is not there yet, but I don't really need it:
I'm building a telemetry project and I need the cheapest solution.
If anypony is still interested in HC on SGY, please reply and I will follow up with more details.
thats pretty awesome news.....this should be moved to development section......
Sent from my Typewriter
A bit of logs to support my statement
Code:
<6>[ 1185.825469] dwc_otg: version 2.60a 22-NOV-2006
<6>[ 1185.825531] lm_driver_register()
<6>[ 1185.825592] lm_match()
<6>[ 1185.825622] lm_bus_probe()
<3>[ 1185.825653] Debug level= 17
<3>[ 1185.825683] dwc_otg lm-2: dwc_otg_driver_probe, version 020-10-01-09
<6>[ 1185.826019] It is Ok to create charging current work queue...
<4>[ 1185.826080] >> create: c483f5e0
<6>[ 1185.826324] start_usb_clk_phy
<4>[ 1185.826354] DWC_otg: 1
<4>[ 1185.826385] DWC_otg: 2
<4>[ 1185.826416] DWC_otg: dwc_otg_core_reset() GRSTCTL=80000000
<4>[ 1185.826446] DWC_otg: dwc_otg_core_reset() value to set=80000001
<4>[ 1185.826477] DWC_otg: 3
<4>[ 1185.931610] DWC_otg: 1
<4>[ 1185.931640] DWC_otg: 2
<4>[ 1185.931671] DWC_otg: dwc_otg_core_reset() GRSTCTL=80000000
<4>[ 1185.931701] DWC_otg: dwc_otg_core_reset() value to set=80000001
<4>[ 1185.931701] DWC_otg: 3
<4>[ 1186.853454] >>>> unicorn 1
<4>[ 1186.853485] dwc_otg_pcd_init(c483f5e0)
<4>[ 1186.853485] Dedicated Tx FIFOs mode
<4>[ 1186.853607] registering handler for irq21
<6>[ 1186.853698] DWC_otg: pcd->setup_pkt=0xff6b3000, pcd->setup_pkt_dma_handle=0x82982000
<6>[ 1186.853729] DWC_otg: pcd->status_buf=0xff6b4000, pcd->status_buf_dma_handle=0x85d33000
<4>[ 1186.853729] pcd->setup_pkt=0xff6b3000, pcd->setup_pkt_dma_handle=0x82982000
<4>[ 1186.853759] pcd->status_buf=0xff6b4000, pcd->status_buf_dma_handle=0x85d33000
<6>[ 1186.853790] DWC_otg: Using DMA mode
<6>[ 1186.853820] dwc_otg lm-2: DWC OTG Controller
<6>[ 1186.853851] dwc_otg lm-2: new USB bus registered, assigned bus number 1
<6>[ 1186.853912] dwc_otg lm-2: irq 21, io mem 0x00000000
<6>[ 1186.853973] DWC_otg: Init: Port Power? op_state=1
<6>[ 1186.853973] DWC_otg: Init: Power Port (0)
<7>[ 1186.854064] usb usb1: default language 0x0409
<7>[ 1186.854125] usb usb1: udev 1, busnum 1, minor = 0
<6>[ 1186.854156] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
<6>[ 1186.854156] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 1186.854187] usb usb1: Product: DWC OTG Controller
<6>[ 1186.854217] usb usb1: Manufacturer: Linux 2.6.35.7 dwc_otg_hcd
<6>[ 1186.854217] usb usb1: SerialNumber: lm-2
<7>[ 1186.856048] usb usb1: usb_probe_device
<7>[ 1186.856109] usb usb1: configuration #1 chosen from 1 choice
<7>[ 1186.856170] usb usb1: adding 1-0:1.0 (config #1, interface 0)
<7>[ 1186.857482] hub 1-0:1.0: usb_probe_interface
<7>[ 1186.857513] hub 1-0:1.0: usb_probe_interface - got id
<6>[ 1186.857543] hub 1-0:1.0: USB hub found
<6>[ 1186.857604] hub 1-0:1.0: 1 port detected
<7>[ 1186.857604] hub 1-0:1.0: standalone hub
<7>[ 1186.857635] hub 1-0:1.0: ganged power switching
<7>[ 1186.857666] hub 1-0:1.0: individual port over-current protection
<7>[ 1186.857666] hub 1-0:1.0: Single TT
<7>[ 1186.857696] hub 1-0:1.0: TT requires at most 8 FS bit times (666 ns)
<7>[ 1186.857696] hub 1-0:1.0: power on to power good time: 2ms
<7>[ 1186.857757] hub 1-0:1.0: local power source is good
<7>[ 1186.857757] hub 1-0:1.0: enabling power on all ports
<7>[ 1186.955078] hub 1-0:1.0: port 1: status 0101 change 0001
<7>[ 1187.056640] hub 1-0:1.0: state 7 ports 1 chg 0002 evt 0000
<7>[ 1187.056701] hub 1-0:1.0: port 1, status 0101, change 0000, 12 Mb/s
<6>[ 1187.251861] usb 1-1: new high speed USB device using dwc_otg and address 2
<7>[ 1187.472076] usb 1-1: default language 0x0409
<7>[ 1187.473388] usb 1-1: udev 2, busnum 1, minor = 1
<6>[ 1187.473419] usb 1-1: New USB device found, idVendor=8564, idProduct=1000
<6>[ 1187.473449] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 1187.473480] usb 1-1: Product: Mass Storage Device
<6>[ 1187.473510] usb 1-1: Manufacturer: JetFlash
<6>[ 1187.473541] usb 1-1: SerialNumber: 5550N3UJAP62NU0R
<7>[ 1187.475555] usb 1-1: usb_probe_device
<7>[ 1187.475616] usb 1-1: configuration #1 chosen from 1 choice
<7>[ 1187.475830] usb 1-1: adding 1-1:1.0 (config #1, interface 0)
<7>[ 1187.477294] libusual 1-1:1.0: usb_probe_interface
<7>[ 1187.477355] libusual 1-1:1.0: usb_probe_interface - got id
<7>[ 1187.477447] usb-storage 1-1:1.0: usb_probe_interface
<7>[ 1187.477478] usb-storage 1-1:1.0: usb_probe_interface - got id
<6>[ 1187.477874] scsi3 : usb-storage 1-1:1.0
<7>[ 1187.482482] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002
<7>[ 1187.482543] hub 1-0:1.0: port 1 enable change, status 00000503
<5>[ 1188.822296] scsi 3:0:0:0: Direct-Access JetFlash Transcend 8GB 1100 PQ: 0 ANSI: 0 CCS
<5>[ 1188.829681] sd 3:0:0:0: [sda] 15826944 512-byte logical blocks: (8.10 GB/7.54 GiB)
<5>[ 1188.830444] sd 3:0:0:0: [sda] Write Protect is off
<7>[ 1188.830505] sd 3:0:0:0: [sda] Mode Sense: 43 00 00 00
<3>[ 1188.830535] sd 3:0:0:0: [sda] Assuming drive cache: write through
<3>[ 1188.834808] sd 3:0:0:0: [sda] Assuming drive cache: write through
<6>[ 1188.834930] sda:
<3>[ 1188.841308] sd 3:0:0:0: [sda] Assuming drive cache: write through
<5>[ 1188.841339] sd 3:0:0:0: [sda] Attached SCSI removable disk
<4>[ 1192.035308] wl_iw_event: dev=eth0 event=20
/mnt/sdcard/mod # mount -r -t vfat /dev/block/sda /sdcard/media
/mnt/sdcard/mod # busybox df /sdcard/media
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/sda 7898024 3906992 3991032 49% /mnt/sdcard/media
/mnt/sdcard/mod # ls /sdcard/media
ubninit
EFI
ubnkern
boot
casper
dists
install
isolinux
pics
pool
preseed
ubnpathl.txt
README.diskdefines
autorun.inf
md5sum.txt
wubi.exe
ubnfilel.txt
ldlinux.sys
syslinux.cfg
menu.c32
HBCD
/mnt/sdcard/mod #
/mnt/sdcard/media # lsmod
dwc_otg 125404 0 - Live 0xbf262000
sd_mod 26464 1 - Live 0xbf136000
usb_storage 34867 1 - Live 0xbf257000
usb_libusual 9839 1 usb_storage, Live 0xbf09c000
scsi_mod 124018 2 sd_mod,usb_storage, Live 0xbf228000
lm 2661 1 dwc_otg, Live 0xbf055000
usbcore 146797 3 dwc_otg,usb_storage,usb_libusual, Live 0xbf18d000
bcm4330 275939 0 - Live 0xbf147000
brcm_headsetsw 7603 0 - Live 0xbf13f000
gememalloc 661 0 - Live 0xbf133000 (P)
h6270enc 3469 0 - Live 0xbf12d000
hx170dec 5362 0 - Live 0xbf125000
sec_param 8980 0 - Live 0xbf11d000
j4fs 70799 1 - Live 0xbf105000 (P)
rfs_fat 247794 3 - Live 0xbf0bd000 (P)
rfs_glue 79181 1 rfs_fat, Live 0xbf0a1000 (P)
fsr_stl 255325 5 j4fs, Live 0xbf05b000 (P)
fsr 338224 2 sec_param,fsr_stl, Live 0xbf000000 (P)
/mnt/sdcard/media #
Currently I'm working on PMU driver to allow the phone to charge while connected via Y-cable.
Once ready I'll post some binaries and patches against stock kernel sources so you will be able to try it out, or take over if you would like to.
After that I could probably try to restore gadget functionality as loadable module and probably add something to switch device/host mode automatically based on cable type.
But personally I don't need gadget functionality at all, so I'm not sure when I will be able to find enough spare time to do this.
PS.
Please don't move it to development section just yet - I won't be able to post there (need 10 posts or something like that).
Here we go, as promised.
I've decided to test whether SGY is powerful enough to play movies from external USB HDD drive with truecrypted ext4 fs.
It turns out to be good enough.
Code:
/mnt/sdcard/mod # busybox cp ../dmsetup /dev
/mnt/sdcard/mod # busybox chmod +x /dev/dmsetup
/mnt/sdcard/mod # insmod usbcore.ko
/mnt/sdcard/mod # insmod lm.ko
/mnt/sdcard/mod # insmod dwc_otg.ko
/mnt/sdcard/mod # insmod scsi_mod.ko
/mnt/sdcard/mod # insmod sd_mod.ko
/mnt/sdcard/mod # insmod usb-libusual.ko
/mnt/sdcard/mod # insmod usb-storage.ko
/mnt/sdcard/mod # busybox ls -l /dev/block/sda
brw------- 1 0 0 8, 0 Jul 20 04:18 /dev/block/sda
/mnt/sdcard/mod # insmod gf128mul.ko
/mnt/sdcard/mod # insmod xts.ko
/mnt/sdcard/mod # /dev/dmsetup create tc0 --table "0 976772656 crypt aes-xts-pla
in64 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 256 8:0 256"
/mnt/sdcard/mod # insmod jbd2.ko
/mnt/sdcard/mod # insmod ext4.ko
/mnt/sdcard/mod # mount -t ext4 -r /dev/mapper/tc0 /sdcard/media
/mnt/sdcard/mod # am start -n com.mxtech.videoplayer.ad/.ActivityScreen -d /mnt/sdcard/media/Videos/cartoon/mlp/My.Little.Pony.Friendship.Is.Magic.S01E26.The.Best.Night.Ever.480p.WEB-DL.DD5.1.h.264-ETP.mkv
Attachment contains kernel update which you can flash using recovery mode.
Basically, it is an ordinary Samsung kernel without any USB code and with some minor hw-related tweaks.
modules.tar.bz2 contains all modules from snippet above plus HID and FTDI support.
It's huge because of ext4.ko. You probably won't need it.
dwc_otg.ko is USB driver itself. At the moment it has host-only functionality.
It means - it is a very bad idea to connect your phone to PC with this module loaded. Be warned.
Also, I'm using Y-cabe with 30k resistor between D+ and D-. This way MUIC thinks that phone is plugged into 1A charger.
At the same time, D+/D- is routed USB PHY. This hack is statically linked into the kernel.
So - don't try to charge your phone with this kernel with chargers with D+/D- shortened.
Oh, yeah. ID pin connection is irrelevant at the moment, so you can hack any micro-usb cable in the middle - no complex soldering required.
Disclaimer: You may brick your phone. Do it on your own risk. This post is developer-oriented.
If you do not fully understand what's written above - better don't do it at all.
uunicorn said:
Here we go, as promised.
I've decided to test whether SGY is powerful enough to play movies from external USB HDD drive with truecrypted ext4 fs.
It turns out to be good enough.
Code:
/mnt/sdcard/mod # busybox cp ../dmsetup /dev
/mnt/sdcard/mod # busybox chmod +x /dev/dmsetup
/mnt/sdcard/mod # insmod usbcore.ko
/mnt/sdcard/mod # insmod lm.ko
/mnt/sdcard/mod # insmod dwc_otg.ko
/mnt/sdcard/mod # insmod scsi_mod.ko
/mnt/sdcard/mod # insmod sd_mod.ko
/mnt/sdcard/mod # insmod usb-libusual.ko
/mnt/sdcard/mod # insmod usb-storage.ko
/mnt/sdcard/mod # busybox ls -l /dev/block/sda
brw------- 1 0 0 8, 0 Jul 20 04:18 /dev/block/sda
/mnt/sdcard/mod # insmod gf128mul.ko
/mnt/sdcard/mod # insmod xts.ko
/mnt/sdcard/mod # /dev/dmsetup create tc0 --table "0 976772656 crypt aes-xts-pla
in64 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 256 8:0 256"
/mnt/sdcard/mod # insmod jbd2.ko
/mnt/sdcard/mod # insmod ext4.ko
/mnt/sdcard/mod # mount -t ext4 -r /dev/mapper/tc0 /sdcard/media
/mnt/sdcard/mod # am start -n com.mxtech.videoplayer.ad/.ActivityScreen -d /mnt/sdcard/media/Videos/cartoon/mlp/My.Little.Pony.Friendship.Is.Magic.S01E26.The.Best.Night.Ever.480p.WEB-DL.DD5.1.h.264-ETP.mkv
Attachment contains kernel update which you can flash using recovery mode.
Basically, it is an ordinary Samsung kernel without any USB code and with some minor hw-related tweaks.
modules.tar.bz2 contains all modules from snippet above plus HID and FTDI support.
It's huge because of ext4.ko. You probably won't need it.
dwc_otg.ko is USB driver itself. At the moment it has host-only functionality.
It means - it is a very bad idea to connect your phone to PC with this module loaded. Be warned.
Also, I'm using Y-cabe with 30k resistor between D+ and D-. This way MUIC thinks that phone is plugged into 1A charger.
At the same time, D+/D- is routed USB PHY. This hack is statically linked into the kernel.
So - don't try to charge your phone with this kernel with chargers with D+/D- shortened.
Oh, yeah. ID pin connection is irrelevant at the moment, so you can hack any micro-usb cable in the middle - no complex soldering required.
Disclaimer: You may brick your phone. Do it on your own risk. This post is developer-oriented.
If you do not fully understand what's written above - better don't do it at all.
Click to expand...
Click to collapse
Dude what you are doing is great but the problem is its too much difficult for average member to understand what all this means....you should give a better discription about what you have done with the kernel and what is the advantage of that and how it will work.....uploading kernels like this could lead to someone bricking their phone....
According to me you should team up with someone and make a thread in dev section.....
Sent from my Dishwasher
-HellRaiser- said:
you should give a better discription about what you have done with the kernel and what is the advantage of that and how it will work.....
Click to expand...
Click to collapse
Yes, I know, but there is nothing user-friendly to show yet.
There is not much profit for an avg phone user until automatic switching between host and device mode is added.
After this feature is implemented in usb driver, it could be incorporated into someones custom kernel distribution and OTG will just work out of the box.
At the moment it is just an ongoing development, which I would like to share with other developers, because I do not think I have enough motivation to finish everything by myself.
-HellRaiser- said:
uploading kernels like this could lead to someone bricking their phone....
Click to expand...
Click to collapse
Hence all the warnings.
-HellRaiser- said:
According to me you should team up with someone and make a thread in dev section.....
Click to expand...
Click to collapse
There is a thread about OTG on SGY already in development section, but I can't even bump it - no rights to post there.
Someone could probably post a link to this thread there, I suppose.
uunicorn said:
There is a thread about OTG on SGY already in development section, but I can't even bump it - no rights to post there.
Someone could probably post a link to this thread there, I suppose.
Click to expand...
Click to collapse
I bumped it for you :good:
btw, I think you need 10 posts in order to start a thread or post on development section.
anyways, keep up the good work!!!
uunicorn said:
Yes, I know, but there is nothing user-friendly to show yet.
There is not much profit for an avg phone user until automatic switching between host and device mode is added.
After this feature is implemented in usb driver, it could be incorporated into someones custom kernel distribution and OTG will just work out of the box.
At the moment it is just an ongoing development, which I would like to share with other developers, because I do not think I have enough motivation to finish everything by myself.
Hence all the warnings.
There is a thread about OTG on SGY already in development section, but I can't even bump it - no rights to post there.
Someone could probably post a link to this thread there, I suppose.
Click to expand...
Click to collapse
uunicorn said:
Yes, I know, but there is nothing user-friendly to show yet.
There is not much profit for an avg phone user until automatic switching between host and device mode is added.
After this feature is implemented in usb driver, it could be incorporated into someones custom kernel distribution and OTG will just work out of the box.
At the moment it is just an ongoing development, which I would like to share with other developers, because I do not think I have enough motivation to finish everything by myself.
Hence all the warnings.
There is a thread about OTG on SGY already in development section, but I can't even bump it - no rights to post there.
Someone could probably post a link to this thread there, I suppose.
Click to expand...
Click to collapse
what need to doing ?
flash your kernel
for what is modules and dmsetup ?
I can't understand ?
uunicorn said:
Here we go, as promised.
I've decided to test whether SGY is powerful enough to play movies from external USB HDD drive with truecrypted ext4 fs.
It turns out to be good enough.
Code:
/mnt/sdcard/mod # busybox cp ../dmsetup /dev
/mnt/sdcard/mod # busybox chmod +x /dev/dmsetup
/mnt/sdcard/mod # insmod usbcore.ko
/mnt/sdcard/mod # insmod lm.ko
/mnt/sdcard/mod # insmod dwc_otg.ko
/mnt/sdcard/mod # insmod scsi_mod.ko
/mnt/sdcard/mod # insmod sd_mod.ko
/mnt/sdcard/mod # insmod usb-libusual.ko
/mnt/sdcard/mod # insmod usb-storage.ko
/mnt/sdcard/mod # busybox ls -l /dev/block/sda
brw------- 1 0 0 8, 0 Jul 20 04:18 /dev/block/sda
/mnt/sdcard/mod # insmod gf128mul.ko
/mnt/sdcard/mod # insmod xts.ko
/mnt/sdcard/mod # /dev/dmsetup create tc0 --table "0 976772656 crypt aes-xts-pla
in64 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 256 8:0 256"
/mnt/sdcard/mod # insmod jbd2.ko
/mnt/sdcard/mod # insmod ext4.ko
/mnt/sdcard/mod # mount -t ext4 -r /dev/mapper/tc0 /sdcard/media
/mnt/sdcard/mod # am start -n com.mxtech.videoplayer.ad/.ActivityScreen -d /mnt/sdcard/media/Videos/cartoon/mlp/My.Little.Pony.Friendship.Is.Magic.S01E26.The.Best.Night.Ever.480p.WEB-DL.DD5.1.h.264-ETP.mkv
Attachment contains kernel update which you can flash using recovery mode.
Basically, it is an ordinary Samsung kernel without any USB code and with some minor hw-related tweaks.
modules.tar.bz2 contains all modules from snippet above plus HID and FTDI support.
It's huge because of ext4.ko. You probably won't need it.
dwc_otg.ko is USB driver itself. At the moment it has host-only functionality.
It means - it is a very bad idea to connect your phone to PC with this module loaded. Be warned.
Also, I'm using Y-cabe with 30k resistor between D+ and D-. This way MUIC thinks that phone is plugged into 1A charger.
At the same time, D+/D- is routed USB PHY. This hack is statically linked into the kernel.
So - don't try to charge your phone with this kernel with chargers with D+/D- shortened.
Oh, yeah. ID pin connection is irrelevant at the moment, so you can hack any micro-usb cable in the middle - no complex soldering required.
Disclaimer: You may brick your phone. Do it on your own risk. This post is developer-oriented.
If you do not fully understand what's written above - better don't do it at all.
Click to expand...
Click to collapse
A Biggg Thanks to you Master....
I am the one who tried for the same target before... But not yet successed..
I am very much curious to see the source or the patch for this.
I hope you will move your code to github or somethig...
Again .. You have Done a Great Job..
Sorry for reviving old post first of all guys, I'm a Galaxy Ace-I user (cooperve, not cooper) and I've found out that our phone in particular, just like the SGY has a BCM21552 (physically that's what the chip reads not 21553 lol), which also supports OTG as I've stated in this thread, I really think it'd be interesting if S5830i and SGY developers could join forces to make this go through
Whats the status of last development of OTG support?

[HOWTO] Add /etc/init.d support and enable OTG on boot [ROOT REQUIRED]

[UPDATE #1] I've added a zip file with the 2 scripts, with UNIX line endings , as suggested below by @aftvNews . Cheers.
[UPDATE #2] I've added a zip file with the 2 extra scripts to go into /etc/init.d, as requested by @Axecaster . These will need the same ownership and permissions as enableotg. They disable SELinux and set the permissions on the recovery directories. Cheers.
Having had a look around the android image on my Fire TV Stick (v1) [ FireOS 5.2.1.1 @rbox ] I found that a script, which doesn't exist, called /system/bin/factoryadb.sh was being run by /init.build.rc on boot.
I was able to create a simple script to run scripts in /etc/init.d on boot.
UPDATE (05/04/19): Now I've got root access on my FireTV Gen 2 [ FireOS 5.2.6.9 ] I can see the see these instructions will also work, although the OTG enabling is not needed
NOTE: I've only tested this on a 1st generation Fire TV Stick but may work on Fire TV boxes if they also call /system/bin/factoryadb.sh from /init.build.rc
Before you do this please make sure factoryadb.sh is NOT on your FireTV and that it is called from /init.build.rc by connecting to your FireTV via adb and running the following commands
Code:
adb shell
su
grep factoryadb /init.build.rc && ls -l /system/bin/factoryadb.sh
Hopefully this will return
Code:
service factoryadb /system/bin/factoryadb.sh
/system/bin/factoryadb.sh: No such file or directory
Now continue ...
My factoryadb.sh script
Code:
#!/system/bin/sh
#
# Execute all scripts in /etc/init.d
if [ -d /etc/init.d ]
then
for f in `ls /etc/init.d/* 2>/dev/null`
do
if [ -s ${f} ]
then
echo Executing ${f} ... >/dev/kmsg
/system/bin/sh ${f}
fi
done
fi
NOTE: Make sure this file has UNIX line endings only. Notepad++ has an option to specify UNIX line endings.
I also have a simple script to enable OTG which I called enableotg, again MUST have UNIX line endings.
Code:
#!/system/bin/sh
echo 1 > /sys/devices/platform/bcmpmu_otg_xceiv/host
Connect to the Fire TV Stick via adb and run the following commands
Code:
adb push factoryadb.sh /sdcard/
adb push enableotg /sdcard/
adb shell
su
mount -o remount,rw /system
mkdir /etc/init.d
cp /sdcard/factoryadb.sh /system/bin/
cp /sdcard/enableotg /etc/init.d/
chown 0:0 /system/bin/factoryadb.sh /etc/init.d /etc/init.d/enableotg
chmod 755 /system/bin/factoryadb.sh /etc/init.d /etc/init.d/enableotg
mount -o remount,ro /system
reboot
When the FireTV Stick has rebooted then reconnect via adb and run the following commands
Code:
adb shell
su
dmesg | grep -e factoryadb -e Executing -e bcmpmu
You should see something similar to
Code:
<6>[ 3.005279] bcmpmu_otg_xceiv bcmpmu_otg_xceiv: Probing started...
<6>[ 3.007690] bcmpmu_otg_xceiv bcmpmu_otg_xceiv: Probing successful
<3>[ 4.998016] init: Warning! Service factoryadb needs a SELinux domain defined; please fix!
<4>[ 5.573242] Executing /etc/init.d/enableotg ...
<6>[ 5.579040] bcmpmu_otg_xceiv bcmpmu_otg_xceiv: Switching to Host
All is working and OTG should be working about 5 seconds after leaving the TWRP screen and long before Android has finished booting.
If you have an ethernet dongle attached it should have an IP address before the launcher starts
NOTE: The SELinux warning can be safely ignored.
Hope this helps.
Nicely done. Clever using the missing factoryadb.sh to roll your own init.d.
Might be easier for some if you just upload/attach your factoryadb.sh and enableotg files that others can download, so there's no need to worry about proper UNIX line endings.
Worked nicely on one of my gen 1 sticks running 5.2.4.1_r2.
OTG works for USB pendrive?
AFTVnews.com said:
Nicely done. Clever using the missing factoryadb.sh to roll your own init.d.
Might be easier for some if you just upload/attach your factoryadb.sh and enableotg files that others can download, so there's no need to worry about proper UNIX line endings.
Click to expand...
Click to collapse
Doh! Completely missed the section to "Attach Files" when I was writing the post
I've now added a zip file with the 2 scripts with UNIX line endings to the post.
Cheers
Awesome job figuring out this was possible! I can confirm the init.d part works just fine on the FireTV-v1 on Rbox v5.2.4.1_r2 (didn't test OTG scripts as I already have a full USB port).
I am going to be adding in your init.d support to my Playing with Fire MOD for the next release.
Now just got to get PS3 / Xbox One controller kernel plugins compiled and working for the Gen1 devices now that init.d works. :good:
dony71 said:
OTG works for USB pendrive?
Click to expand...
Click to collapse
I tried this on fire tv stick 1, usb storage does not work.
dmesg shows my Kingston USB pendrive being recognized by kernel,
but registered driver debus_usbdev ?
So I guess kernel doesn't have USB storage driver?
----------------------------------------------------------------------------------------------------
<6>[ 7.267791] usb 3-1: new high speed USB device number 2 using dwc_otg
<6>[ 7.538024] usb 3-1: New USB device found, idVendor=0951, idProduct=1642
<6>[ 7.538116] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
<6>[ 7.538238] usb 3-1: Product: DT 101 G2
<6>[ 7.538330] usb 3-1: Manufacturer: Kingston
<6>[ 7.538482] usb 3-1: SerialNumber: 001CC0EC3509EA50B0000232
<6>[ 47.829345] usbcore: registered new interface driver dbus_usbdev
<3>[ 60.385131] init: Warning! Service adb_usb needs a SELinux domain defined; please fix!
Does this enable the use of USB storage ? as ive had this setup for over 6 months now to enable usb pheripal support on boot (with a script booter). If not i guess its still good to do away with the extra apk i had installed to enable my script at boot.
What does this actually do? My FireTV already can read from usb drives.
tdfsu said:
What does this actually do? My FireTV already can read from usb drives.
Click to expand...
Click to collapse
Seems mainly for gen 1 sticks to enable usb peripherals. Each boot requires a command to be re-run to recognize usb keyboards, mice, wired networking port, etc. Someone correct me if I'm wrong, but this configuration could in-theory assign multiple scripts to run on boot without extra apps installed.
Axecaster said:
Seems mainly for gen 1 sticks to enable usb peripherals. Each boot requires a command to be re-run to recognize usb keyboards, mice, wired networking port, etc. Someone correct me if I'm wrong, but this configuration could in-theory assign multiple scripts to run on boot without extra apps installed.
Click to expand...
Click to collapse
Yes Gen2 sticks and the main FireTV's seem to have OTG already enabled but Gen1 sticks don't.
However even though I've only specified enabling OTG in my initial post, as Axecaster mentioned I do in fact have a number of scripts in /etc/init.d that run on boot.
e.g. Set SELinux to Permissive, set full R/W access on the recovery directories, cleanup some temp files on boot etc
I'm currently checking to see if I can set a static IP on the USB Ethernet adapter I use with my Gen1 stick which will most likely result in a new script in /etc/init.d
I also need to investigate the USB storage options more though. Might be the same issue as I'm having with NFS mounts. I can mount an NFS share but currently only root can see it!
Hope this helps.
tgellen said:
Yes Gen2 sticks and the main FireTV's seem to have OTG already enabled but Gen1 sticks don't.
However even though I've only specified enabling OTG in my initial post, as Axecaster mentioned I do in fact have a number of scripts in /etc/init.d that run on boot.
e.g. Set SELinux to Permissive, set full R/W access on the recovery directories, cleanup some temp files on boot etc
I'm currently checking to see if I can set a static IP on the USB Ethernet adapter I use with my Gen1 stick which will most likely result in a new script in /etc/init.d
I also need to investigate the USB storage options more though. Might be the same issue as I'm having with NFS mounts. I can mount an NFS share but currently only root can see it!
Hope this helps.
Click to expand...
Click to collapse
Have you checked or modified your "persist-usb-config" file yet? If your's has different values than this (from a FireTV-Box) edit it to match mine and see if that helps.
Code:
[email protected]:/ # cat /data/property/persist.sys.usb.config
diag,serial_smd,serial_tty,rmnet_bam,mass_storage,adb
As for your NFS shares issue you are going to need to do a Bind Mount to get non-root users able to access the directory. Im using the same bind-mount method to get a bunch of additional GApps installed on the FireTV by binding folders in /data/local/ --> /system/priv-app and using your /etc/init.d/ discovery to launch it automatically on boot.
[email protected]: # mkdir /data/local/nfs && chmod 0755 /data/local/nfs && chown 0:0 /data/local/nfs
init.d startup script:
Code:
#!/system/bin/sh
NFSPATH=/path/to/nfs
NFSDATA=/data/local/nfs
(mount -o bind $NFSPATH $NFSDATA) ; (mount -o remount nosuid,nodev,noexec,reltime,async $NFSPATH)
SimLynks said:
Have you checked or modified your "persist-usb-config" file yet? If your's has different values than this (from a FireTV-Box) edit it to match mine and see if that helps.
Click to expand...
Click to collapse
Result:
Code:
[email protected]:/ # cat /data/property/persist.sys.usb.config
[B]adb[/B][email protected]:/ #
I pulled the file, replaced "adb" with "iag,serial_smd,serial_tty,rmnet_bam,mass_storage,adb", pushed it back and rebooted the device.
Result: ADB is disabled and otg doesn't seem to work (usb flash drive)
Enabling ADB sets the file back to "adb" and after a reboot otg is working again.
after installing xposed framework on the fire tv stick this method for otg on boot not longer works.
any solutions?
thecoonx said:
after installing xposed framework on the fire tv stick this method for otg on boot not longer works.
any solutions?
Click to expand...
Click to collapse
Hmm. I installed this method after xposed framework. As far as I'm aware, everything seems to be working.
thecoonx said:
after installing xposed framework on the fire tv stick this method for otg on boot not longer works.
any solutions?
Click to expand...
Click to collapse
Axecaster said:
Hmm. I installed this method after xposed framework. As far as I'm aware, everything seems to be working.
Click to expand...
Click to collapse
So only setup your scripts after you are done flashing a PreRooted ROM &/or SuperSU &/or XPosed Framework. So in other words only after your done messing with things that mess with /System in TWRP. Or you will have to reset them again.
SimLynks said:
Have you checked or modified your "persist-usb-config" file yet? If your's has different values than this (from a FireTV-Box) edit it to match mine and see if that helps.
Code:
[email protected]:/ # cat /data/property/persist.sys.usb.config
diag,serial_smd,serial_tty,rmnet_bam,mass_storage,adb
As for your NFS shares issue you are going to need to do a Bind Mount to get non-root users able to access the directory. Im using the same bind-mount method to get a bunch of additional GApps installed on the FireTV by binding folders in /data/local/ --> /system/priv-app and using your /etc/init.d/ discovery to launch it automatically on boot.
[email protected]: # mkdir /data/local/nfs && chmod 0755 /data/local/nfs && chown 0:0 /data/local/nfs
init.d startup script:
Code:
#!/system/bin/sh
NFSPATH=/path/to/nfs
NFSDATA=/data/local/nfs
(mount -o bind $NFSPATH $NFSDATA) ; (mount -o remount nosuid,nodev,noexec,reltime,async $NFSPATH)
Click to expand...
Click to collapse
Hi SimLynks,
Thanks for your suggestion. The bind mount did make the directory available for the non-root user but unfortunately it's contents were still only visible to the root user
I'll keep on trying
Cheers.
tgellen said:
[UPDATE #1] I've added a zip file with the 2 scripts, with UNIX line endings , as suggested below by AFTVNews. Cheers.
[UPDATE #2] I've added a zip file with the 2 extra scripts to go into /etc/init.d, as requested by Axecaster. These will need the same ownership and permissions as enableotg. They disable SELinux and set the permissions on the recovery directories. Cheers.
Having had a look around the android image on my Fire TV Stick (v1) [FireOS 5.2.1.1 rbox] I found that a script, which doesn't exist, called /system/bin/factoryadb.sh was being run by /init.build.rc on boot.
I was able to create a simple script to run scripts in /etc/init.d on boot.
NOTE: I've only tested this on a 1st generation Fire TV Stick but may work on Fire TV boxes if they also call /system/bin/factoryadb.sh from /init.build.rc
Before you do this please make sure factoryadb.sh is NOT on your FireTV and that it is called from /init.build.rc by connecting to your FireTV via adb and running the following commands
Code:
adb shell
su
grep factoryadb /init.build.rc && ls -l /system/bin/factoryadb.sh
Hopefully this will return
Code:
service factoryadb /system/bin/factoryadb.sh
/system/bin/factoryadb.sh: No such file or directory
Now continue ...
My factoryadb.sh script
Code:
#!/system/bin/sh
#
# Execute all scripts in /etc/init.d
if [ -d /etc/init.d ]
then
for f in `ls /etc/init.d/* 2>/dev/null`
do
if [ -s ${f} ]
then
echo Executing ${f} ... >/dev/kmsg
/system/bin/sh ${f}
fi
done
fi
NOTE: Make sure this file has UNIX line endings only. Notepad++ has an option to specify UNIX line endings.
I also have a simple script to enable OTG which I called enableotg, again MUST have UNIX line endings.
Code:
#!/system/bin/sh
echo 1 > /sys/devices/platform/bcmpmu_otg_xceiv/host
Connect to the Fire TV Stick via adb and run the following commands
Code:
adb push factoryadb.sh /sdcard/
adb push enableotg /sdcard/
adb shell
su
mount -o remount,rw /system
mkdir /etc/init.d
cp /sdcard/factoryadb.sh /system/bin/
cp /sdcard/enableotg /etc/init.d/
chown 0:0 /system/bin/factoryadb.sh /etc/init.d /etc/init.d/enableotg
chmod 755 /system/bin/factoryadb.sh /etc/init.d /etc/init.d/enableotg
mount -o remount,ro /system
reboot
When the FireTV Stick has rebooted then reconnect via adb and run the following commands
Code:
adb shell
su
dmesg | grep -e factoryadb -e Executing -e bcmpmu
You should see something similar to
Code:
<6>[ 3.005279] bcmpmu_otg_xceiv bcmpmu_otg_xceiv: Probing started...
<6>[ 3.007690] bcmpmu_otg_xceiv bcmpmu_otg_xceiv: Probing successful
<3>[ 4.998016] init: Warning! Service factoryadb needs a SELinux domain defined; please fix!
<4>[ 5.573242] Executing /etc/init.d/enableotg ...
<6>[ 5.579040] bcmpmu_otg_xceiv bcmpmu_otg_xceiv: Switching to Host
All is working and OTG should be working about 5 seconds after leaving the TWRP screen and long before Android has finished booting.
If you have an ethernet dongle attached it should have an IP address before the launcher starts
NOTE: The SELinux warning can be safely ignored.
Hope this helps.
Click to expand...
Click to collapse
Can this be used in some way to enable otg while at the TWRP countdown bar ( as to use keyboard/mouse/airmouse within TWRP), As it's a whole lot easier to use than the ADB mouse, having to plug firestick into laptop/computer if you need to be in recovery, if it is possible it could be easier.
I use the airmouse/keyboard method myself when I go I to recovery but have to use my home made otg cable and swap over usb to computer after running the command to usb dongle for the airmouse (melee F10 pro). After the command has run while plugged into my laptop I unplug the laptop connection and plug in my dongle and I navigate TWRP with my remote.
It is any chance that we can enable OTG on no-rooted devices of firetv gen 1 ?I have firmware 5.2.6.7 so I think there is no way I can root the device. Thanks!
minute said:
It is any chance that we can enable OTG on no-rooted devices of firetv gen 1 ?I have firmware 5.2.6.7 so I think there is no way I can root the device. Thanks!
Click to expand...
Click to collapse
Sorry. Unfortunately you need root access to change the OTG value on the FireTV gen 1

Categories

Resources