maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   N900 will not allow USB OTG! (https://talk.maemo.org/showthread.php?t=31921)

sarahn 2010-05-25 17:37

Re: N900 will not allow USB OTG!
 
Unfortunately I was not getting email notifications for this thread so I didn't realize there was work going on. This is awesome!

I am trying to quickly digest what all has happened since I looked last, there has been more than 20 pages of posts, so please excuse me for repeats. To summarize, it looks like
1. It is possible to force VBUS on by controlling bq24150 (I need to do some more reading here.)
2. host mode works by connecting to PC, use HNP, and then connecting to another device within 5 seconds (moving the state machine to b_host)
3. It is not yet possible to enter host mode without connecting to a PC first as described above.

Is this correct? Is there a wrapup of kernel patches somewhere?

Where I left off was getting a connection by forcing host mode w/ a power injecting cable, but the state machine entered the suspend state. Found some obvious places where that could cause problems but I haven't sat down to play with it again yet.

Thanks in advance.

joerg_rw 2010-05-25 20:16

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by sarahn (Post 676521)
Unfortunately I was not getting email notifications for this thread so I didn't realize there was work going on. This is awesome!

I am trying to quickly digest what all has happened since I looked last, there has been more than 20 pages of posts, so please excuse me for repeats. To summarize, it looks like
1. It is possible to force VBUS on by controlling bq24150 (I need to do some more reading here.)
2. host mode works by connecting to PC, use HNP, and then connecting to another device within 5 seconds (moving the state machine to b_host)
3. It is not yet possible to enter host mode without connecting to a PC first as described above.

Is this correct? Is there a wrapup of kernel patches somewhere?

Where I left off was getting a connection by forcing host mode w/ a power injecting cable, but the state machine entered the suspend state. Found some obvious places where that could cause problems but I haven't sat down to play with it again yet.

Thanks in advance.

Quite precise sum up, fine to have you on board again :-)
There are no kernel patches yet that would really help in entering hostmode directly. All patching so far was more like testing how the whole thing reacts, nothing of that will result in a kernel patch needed to put hostmode to work - probably even nothing of that is needed for the HNP fake hostmode stuff in the end.

sarahn 2010-05-25 22:49

Re: N900 will not allow USB OTG!
 
OK. As I said, I was pursuing forced host mode which AFAIK does require kernel patches. I have those posted back a ways though I do not know if it's the right strategy or not. Have you had a chance to look at those?

joerg_rw 2010-05-26 07:11

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by sarahn (Post 677333)
OK. As I said, I was pursuing forced host mode which AFAIK does require kernel patches. I have those posted back a ways though I do not know if it's the right strategy or not. Have you had a chance to look at those?

Javispedro (and me, talking nonsense ;-P) did tests with FORCE_HOSTMODE patches in kernel some days ago. See last post of mine with the IRC quotes. Javispedro missed the state transitions in the musb core state machine (if there is any?).
If you got full real hostmode working with a Y-cable for feeding VBUS, then we're already done, as we got the VBUS thing working by now (more or less, bme needs a kick in the a...)

:-)

cheers
jOERG

sarahn 2010-05-26 17:37

Re: N900 will not allow USB OTG!
 
HNP isn't workng for me; musb core goes into host mode but I don't get any urb or anything. Is a custom kernel actually required?

MohammadAG 2010-05-26 17:42

Re: N900 will not allow USB OTG!
 
Yes, the whitelist and blacklist options should be set to n, I'll PM you a precompiled zImage

blue_led 2010-05-26 20:02

Re: N900 will not allow USB OTG!
 
@egoshin & joerg
please try attempt to enter host mode following bellow sequence !
1 apply vbus from bq
2 set r15k
3 force session
4 clear R D+
5 force session end ( clear SESSION )

at this point bus must be SE0

6 force host
7 check / set r15k
8 clear fifo buffers( FLUSHFIFO )
9 apply vbus 5v bq
10 set R D+ ( fake peripheral )
11 set session bit
12 clear session bit ( no device on bus )

blue_led 2010-05-27 23:41

Re: N900 will not allow USB OTG!
 
from http://www.usb.org/developers/docs/usb_20_052510.zip i analize again ( n times) USB OTG and EH 2-0.pdf

for start FORGET a-device or embedded host state diagram because it is initialized by ID = 0 even twl4030 have an functional & valid id signal
look closer to otg B_device ( fig 7.3 - otg b device state diagram )
from start state machine will enter to b_idle state ( reason : id =1 )
the only one path to b_host state is through 2 intermediate stages
b_peripheral & b_wait_acon
to reach b_peripheral the only one condition is b_sess_vld and this is TRUE when the B-device above VOTG_SESS_VLD ( 0.8 - 4 V )
so attach to a pc and 3.5 v from any source is sufficient to reach this stage
let go further
b_wait_acon
the conditions to advance to this stage are:
b_bus_req TRUE during the time that the Application running on the B-device wants to use the bus
&
b_hnp_en TRUE when the B-device has accepted the SetFeature(b_hnp_enable)
&
a_bus_suspend ( real life : disconnect from pc and leave usb bus to settle down )

to enter b_host the condition is detection of a peripheral performing srp ( a_conn )

it is f.. simple . we can't see forest behind trees.
egoshin follow this path with success

so limitaton on real n900 device with not id pin hardwired : any a-state machine can not start, and bme with charger check procedure prevent bus to enter suspend state and my final conclusions are
as nokia deliver n900 ( with glorious bme ) can't perform otg as everybody know that
the only host hope for us is b_host and i am confident it can be reached without a pc

flailingmonkey 2010-05-28 06:32

Re: N900 will not allow USB OTG!
 
I have started to wonder if Nokia is actually not allowed to assist in these efforts to determine how to manually turn the USB controller to hostmode, due to USB Consortium crap, or if its just due to the bme system being closed-source. Does the partial OTG software implementation in the drivers provide any actual benefits beyond pure peripheral mode? Or is it there because they started work on OTG and realized they couldn't finish it, and reworked that code instead of removing all the OTG-ness.

I have been wondering about literally hacking the bme. basically, the program would not change, and maybe with the magic of LD_PRELOAD and some tracing, we'd fake out the syscalls/library calls it would make (akin to how rootkits hide themselves).

titan 2010-05-28 08:08

Re: N900 will not allow USB OTG!
 
FYI: I had a_host working (after connecting to PC) but it was difficult to reproduce

EDIT: oops. just noticed javispredo also mentioned in his post...

IRC log from last week:
Code:

musb_stage0_irq      580: <== Power=e9, DevCtl=dd, int_usb=0x10
[23:51] t-tan: [  637.942199] musb_stage0_irq      875: CONNECT (a_host) devctl dd
[23:51] t-tan: interesting. havent seen this before (a_host)
..
[23:53] t-tan: before: musb_stage0_irq      859: CONNECT as b_peripheral???                                         
[23:53] t-tan: May 20 20:47:24 T900 kernel: [  99.135070] musb_stage0_irq      875: CONNECT (b_peripheral) devctl dd
[23:53] t-tan: with my new patch

Quote:

Originally Posted by blue_led (Post 684310)
so limitaton on real n900 device with not id pin hardwired : any a-state machine can not start, and bme with charger check procedure prevent bus to enter suspend state and my final conclusions are
as nokia deliver n900 ( with glorious bme ) can't perform otg as everybody know that
the only host hope for us is b_host and i am confident it can be reached without a pc



All times are GMT. The time now is 23:23.

vBulletin® Version 3.8.8