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)

SpeedEvil 2010-05-15 21:14

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by titan (Post 659887)
1) modprobe bq27x00_battery and check /sys/class/power_supply/bq27200-0
3) both are compiled in
ls /sys/kernel/debug/usbmon/
0s 0u 1s 1t 1u
5) always backup and be prepared to reflash :)

One caveat.
the current exposed by the bq27200 needs multiplied by (20/3.57)mA to get a current.

It's a raw value from the chip.
the '20' is arguable - but is at least more or less reasonable.
This is as the chip really reads out in units of 3.57uV, and the resistor the battery current is applied across is 20mR in the datasheet recommendation.

titan 2010-05-16 22:50

Re: N900 will not allow USB OTG!
 
FYI:
echo 5 > /sys/module/musb_hdrc/parameters/debug
enables USB debugging in dmesg!
it contains very interesting information incl. line numbers

javispedro 2010-05-17 00:41

Re: N900 will not allow USB OTG!
 
Using egoshin's idea, I got a DisplayLink device working:

http://depot.javispedro.com/nit/usb/displaylink.jpg

This is the same USB monitor shown at the DisplayLink homepage, connected to a N900, in dual screen "clone" mode (more accurately x11vnc, vnc2dl and libdlo, all on the N900). vnc2dl seems to have a 1280x1024 forced resolution.

Basically the requirement of connecting the N900 to a host previously is the key. If you play your cards well you don't even need to patch the kernel (Y-cable, or fully self powered bug, etc.).
I initially though that this requirement came from a g_mass_storage bug that seemingly also happens on the beagleboard, but I was wrong.

Seemingly, DocScrutinizer is right: for some reason after repeating egoshin's steps the N900 seems incapable of closing any USB session, and thus after you unplug it from the host it still believes it's plugged into it, keeping everything powered on. This tricks the driver's OTG state machine into some weirdo state where something starts moving :).

Also, with this method you cannot unplug the hub from the N900, as per the above the N900 will keep on thinking it's still connected to it, thus causing mayhem on the kernel.

qole 2010-05-17 06:28

Re: N900 will not allow USB OTG!
 
apparently superheroes can be on multiple teams at the same time. :)

Keep up the good work guys!

titan 2010-05-17 17:24

Re: N900 will not allow USB OTG!
 
I cannot replicate this. btw, it is /proc/driver/musb_hdrc

Quote:

Originally Posted by egoshin (Post 657866)
If you want repeat a test, some detailed explanation is here:
C. Connect to PC and answer "PC Suite" to mode question.

D. echo host >/sys/devices/platform/musb_hdrc/mode
You should see in /var/log/syslog a message "twl4030_set_host() after 4030 OTG_CTRL=0x26" - the '2' is a significant.

E. echo H >/proc/drivers/musb_hdrc

F. reattach USB cable from PC to self powered USB hub with memory stick or to external hard disk.

E. Look into /var/log/syslog - You can see a lot of messages and two are most valuable - "Initializing USB Mass Storage driver" and "
USB Mass Storage support registered". And in between you may see "scsi0 : SCSI emulation for USB Mass Storage devices".


javispedro 2010-05-17 17:37

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by qole (Post 661857)
apparently superheroes can be on multiple teams at the same time. :)

Hah, not really a superhero as I discarded all what I was doing to test egoshin's method, which is the first time I've ever seen it moving.

Btw, you might need the patches after all -- seems I had some previous leftover on my N900 (be careful as some settings survive rebooting and reflashing, forcing you to remove the battery).

egoshin 2010-05-17 17:52

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by titan (Post 662763)
I cannot replicate this. btw, it is /proc/driver/musb_hdrc

Interesting. Sometime I can't do it too but I blamed it to some leftovers and repeat it after removing battery.

But there is still a possibility that some process like BME or DSME intervenes and creates a problem.

BTW, did you see in log a message "twl4030_set_host() after 4030 OTG_CTRL=0x26"?

egoshin 2010-05-17 17:59

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by javispedro (Post 661612)
Using egoshin's idea, I got a DisplayLink device working:

http://depot.javispedro.com/nit/usb/displaylink.jpg

This is the same USB monitor shown at the DisplayLink homepage, connected to a N900, in dual screen "clone" mode (more accurately x11vnc, vnc2dl and libdlo, all on the N900). vnc2dl seems to have a 1280x1024 forced resolution.

Basically the requirement of connecting the N900 to a host previously is the key. If you play your cards well you don't even need to patch the kernel (Y-cable, or fully self powered bug, etc.).
I initially though that this requirement came from a g_mass_storage bug that seemingly also happens on the beagleboard, but I was wrong.

Seemingly, DocScrutinizer is right: for some reason after repeating egoshin's steps the N900 seems incapable of closing any USB session, and thus after you unplug it from the host it still believes it's plugged into it, keeping everything powered on. This tricks the driver's OTG state machine into some weirdo state where something starts moving :).

Also, with this method you cannot unplug the hub from the N900, as per the above the N900 will keep on thinking it's still connected to it, thus causing mayhem on the kernel.

To return back from host mode state to normal just do:

echo peripheral >/sys/devices/platform/musb_hdrc/mode

It will cancel VBUS and it immediately stops a session.

BUT! It doesn't do the right stuff about DISK - you should unmount it first, especially if it is not ISO9660 format but some Linux file system.

javispedro 2010-05-17 18:03

Re: N900 will not allow USB OTG!
 
Quote:

Originally Posted by egoshin (Post 662823)
To return back from host mode state to normal just do:

echo peripheral >/sys/devices/platform/musb_hdrc/mode

It will cancel VBUS and it immediately stops a session.

I couldn't -- as I've noticed though my twl3040 was possibly in some random state -- I wasn't using your kernel.

hcm 2010-05-17 18:15

Re: N900 will not allow USB OTG!
 
fyi, just found a comparison chart of USB PHY:
http://www.ebv.com/fileadmin/product...sceivers_1.pdf

and checked out the isp1704a because of its similarity to the 1707:
http://www.stericsson.com/product/222222.jsp

It is 100% pin-compatible to the chip in the N900-schematic (which only misses ID and PSW, in comparison to isp1704a, but ID should be present somehow, considering its an OTG chip…)

happy reading :)


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

vBulletin® Version 3.8.8