Closed Thread
Thread Tools
Posts: 992 | Thanked: 995 times | Joined on Dec 2009 @ California
#851
Originally Posted by egoshin View Post
@Joerg

Again, good news - I repeated test suggested by you but replaced 'stop bme' to 'killall -SIGSTOP bme_RX-51'.



Now it works, even on stock (unmodified) kernel.

However, I doesn't work well with my USB memory stick because read returns error -32 (EPIPE). But it still exchanges some info because device "not accepting address 8" (or ever). A modified kernel is needed to find out details why it reads descriptors with EPIPE.
I researched a log and a kernel. The diagnostics shows that with VBUS=1 from BQxxxxx chip (no setup of VBUS in TWL4030) hard disk doesn't respond while N900 reads messages from it...

EDIT: USB memory stick, not hard disk.

But self-powered hub still responds.

Last edited by egoshin; 2010-05-13 at 04:34.
 

The Following User Says Thank You to egoshin For This Useful Post:
Posts: 992 | Thanked: 995 times | Joined on Dec 2009 @ California
#852
Success!

I just was able to mount USB stick via self-powered HUB and read it.

Device - /dev/sda1

Details will be later, but now - modified kernel. I am looking into right modification.

BTW, the USB stick problem with VBUS from BQxxxxx seems to be a connector problem - I was able to communicate with it too (USB stick directly connected to N900).
 

The Following 106 Users Say Thank You to egoshin For This Useful Post:
*Sonic*, 6sicSIX, acvetkov, ahmadamaj, aligatro, anapospastos, andree, Appiah, Arrancamos, attila77, azstunt, b-man, beli, Big Phat Jan, bigears5000, BluesLee, blue_led, borghal, cantes, cb22, ChadiM, cheve, choubbi, chrget, cipper, clasificado, corecode, cproc, Cue, daperl, donaggio, Dousan, dwaradzyn, EugeneS, explit, ezmendriz, flailingmonkey, frals, freemangordon, giannoug, gobuki, gopalakr, Graham Cobb, Hmoobwarrior, imperiallight, infernalrob3rt, javispedro, jimx, jkq, joerg_rw, johnel, jukey, Kegetys, Kilian, kimitake, lbt, lcuk, lemmyslender, Lullen, Marshall Banana, max_power, Megaltariak, mnaveed, MohammadAG, momoyan, morusaka, mtran66, musculus, mveplus, mykhal, ndi, Netweaver, Nikem, Orin, Otaku, OVK, Pedram, pierro78, pillar, qole, rcastberg, rmoravcik, rnb89, S0urcerr0r, sachin007, sjgadsby, skalogre, smoku, sorensen, SpeedEvil, stlpaul, Stskeeps, thecursedfly, thp, titan, tomaszf, Trek1701, trurl, twaelti, twoboxen, v13, vkv.raju, zaheerm, zod, zvogt, zwer
Posts: 258 | Thanked: 138 times | Joined on Oct 2009 @ St. Louis, MO, USA
#853
Originally Posted by egoshin View Post
Success!

I just was able to mount USB stick via self-powered HUB and read it.

Device - /dev/sda1

Details will be later, but now - modified kernel. I am looking into right modification.

BTW, the USB stick problem with VBUS from BQxxxxx seems to be a connector problem - I was able to communicate with it too (USB stick directly connected to N900).
I'm sure it goes without saying... but you are the man. Well, you and all the other people who helped are the collective man. Any chance the requisite fixes can be folded into titan's kernel?
 
Posts: 946 | Thanked: 1,650 times | Joined on Oct 2009 @ Germany
#854
I just got a hostmode-only kernel running!
it boots up normally, battery info and USB charging is broken (as expected)
WARNING: this is only for experienced developers! do not install as noob
http://maemory.com/N900/kernel/hostmode/
you need to replace /etc/event.d/bme with my modified file (make a backup!).
In the worst case it ends up in a reboot loop due to bme.
you could uncomment the line "cp /etc/event.replace.d/..." in the script to
restore the original at the first start. if it fails to boot you would
only need to reflash the stock kernel.

EDIT: bascially bme dies during boot but booting continues. so no workarounds for bme are needed

now if I only had my USB F/F adapter here...

Last edited by titan; 2010-05-17 at 07:08. Reason: bme, loop
 

The Following 20 Users Say Thank You to titan For This Useful Post:
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#855
Originally Posted by twoboxen View Post
I'm sure it goes without saying... but you are the man. Well, you and all the other people who helped are the collective man. Any chance the requisite fixes can be folded into titan's kernel?
Titan just booted a hostmode-only kernel this very moment.
[2010-05-13 16:33:17] <t-tan> it continues !!!
[2010-05-13 16:33:50] <t-tan> I'm running a hostmode-only kernel
[2010-05-13 16:35:07] <DocScrutinizer> t-tan: what coninues?? the kernel booted up to full system?
[2010-05-13 16:35:18] <t-tan> yes. success!
Egoshin's method implies conecting the N900 to a PC prior to switching to hostmode, and that won't help a lot out in the field, will it?
http://talk.maemo.org/showpost.php?p...&postcount=835
1. plug to PC, answer "PC suite"
2. echo host >/sys/devices/platform/musb_hdrc/mode
3. echo H >/proc/driver/musb_hdrc
4. /bin/sh -c 'killall -SIGSTOP bme_RX-51 && sleep 3 && /usr/local/i2cset -y -m 0x07 2 0x6b 0x01 0x05 && while sleep 28; do /usr/local/i2cset -y -m 0x80 2 0x6b 0x00 0x80; done &
5. disconnect USB from PC and connect to USB memory stick or extrnal hard disk or HUB.
6. lsusb -- or just wait
7. Look into /var/log/syslog for messages.
See 1. to 5. For the answer "PC suite" part see also http://talk.maemo.org/showthread.php...357#post635357

So we still struggle to get GENERIC hostmode, not a tricky way to put OTG statemachine into a pathological state by fiddling with VBUS timings, where it detects a drive as another OTG peer.
[2010-05-13 14:52:07] <DocScrutinizer> let me put it this way: it's insane to trick a potentially
flawed OTG statemachine into a certain state by fiddling with VBUS timings, while
a plain vanilla generic hostmode doesn't care about VBUS at all
Stay calm and patient and wait what's going on, all the smart people know you want hostmode as soon as possible, and neither Titan nor anybody else will hesitate to ship whatever is needed to put it to work for everybody, once we figured how to implement a reliable useful thing. At the moment this is still bleeding edge R&D, and surely it's strongly discourraged for non-developers to try and put it to use, as there's no evaluation whatsoever about risks, and it's simply not yet working for the intended usecases.

cheers
jOERG

[edit] titan beat me on posting speed ;-) so please excuse if this sounds a bit weird, as I wasn't aware of his previous post when I hit the "reply" button

Last edited by joerg_rw; 2010-05-13 at 15:14.
 

The Following 16 Users Say Thank You to joerg_rw For This Useful Post:
Posts: 306 | Thanked: 566 times | Joined on Jan 2010 @ Romania
#856
look into /etc/bme & /etc/event.d/bme.dpkg-new
at the end of bme f* script !

description "starting bme"
author "Simo Piiroinen"

console output

start on started dsme
stop on starting shutdown

service
nice -1

env LOGGER='/usr/bin/logger -s -tBME'
env STOP_FLAG=/tmp/bme.was.stopped

env SYSFS_VBUS_PATH=/sys/class/i2c-adapter/i2c-1/1-0048/twl4030_usb/vbus
env BACKLIGHT_PATH=/sys/class/backlight/acx565akm/brightness

pre-start script
set +e
$LOGGER -pdaemon.notice 'pre-start'

EXPORT_CARDS=0

case $(cat /tmp/STATE) in
USER)
if [ -e /var/lib/ke-recv/usb_phonet_mode ]; then
modprobe g_nokia || true
initctl emit G_NOKIA_READY
else
modprobe g_file_storage luns=2 stall=0 removable || true
fi
;;
ACT_DEAD)
modprobe g_file_storage luns=2 stall=0 || true
EXPORT_CARDS=1
;;
*)
$LOGGER -pdaemon.notice 'skip modprobe g_*'
;;
esac

DISC='/dev/mmcblk0p1'
CARD='/dev/mmcblk1'

LUN0='/sys/devices/platform/musb_hdrc/gadget/gadget-lun0/file'
LUN1='/sys/devices/platform/musb_hdrc/gadget/gadget-lun1/file'

if [ $EXPORT_CARDS -eq 1 ]; then
if [ -b $DISC ]; then
echo $DISC > $LUN0 || true
fi
if [ -b $CARD ]; then
echo $CARD > $LUN1 || true
fi
fi

if ! /usr/sbin/waitfordsme ; then
$LOGGER -pdaemon.crit 'waitfordsme failed'
exit 1
fi

# check dead battery pre-charge
# (or poweroff if battery can't be charged)
if [ $(cat $SYSFS_VBUS_PATH) -eq 1 ]; then
$LOGGER -pdaemon.notice 'starting battery precharge'

# Minimize power usage during pre-charge
echo 0 > $BACKLIGHT_PATH

# Drive yellow led with device charging pattern to improve UX
# Must be done before actually running the "bme-RX-51 -b" - its slow

# Clearing LED-state to be sure
echo "disabled" > /sys/class/i2c-adapter/i2c-2/2-0032/engine1_mode
echo "disabled" > /sys/class/i2c-adapter/i2c-2/2-0032/engine2_mode
echo 0 > /sys/class/leds/lp5523:r/brightness
echo 0 > /sys/class/leds/lp5523:g/brightness
echo 0 > /sys/class/leds/lp5523:b/brightness

# Setting yellow light pattern and running it
echo "load" > /sys/class/i2c-adapter/i2c-2/2-0032/engine1_mode
echo "000001100" > /sys/class/i2c-adapter/i2c-2/2-0032/engine1_leds
echo "9d804000427f0d7f7f007f0042000000" > /sys/class/i2c-adapter/i2c-2/2-0032/engine1_load
echo "load" > /sys/class/i2c-adapter/i2c-2/2-0032/engine2_mode
echo "000000000" > /sys/class/i2c-adapter/i2c-2/2-0032/engine2_leds
echo "9d800000" > /sys/class/i2c-adapter/i2c-2/2-0032/engine2_load
echo "run" > /sys/class/i2c-adapter/i2c-2/2-0032/engine2_mode
echo "run" > /sys/class/i2c-adapter/i2c-2/2-0032/engine1_mode
echo 20 > /sys/class/leds/lp5523:r/led_current
echo 2 > /sys/class/leds/lp5523:g/led_current
echo 0 > /sys/class/leds/lp5523:b/led_current

/usr/sbin/bme_RX-51 -b
case $? in
0)
$LOGGER -pdaemon.notice 'precharge -> ok'
;;
2)
$LOGGER -pdaemon.crit 'precharge -> power off'
# power off request has been sent to dsme

# Turn off charging-LED to avoid "ghost charging" when cable removed
echo "disabled" > /sys/class/i2c-adapter/i2c-2/2-0032/engine1_mode
echo "disabled" > /sys/class/i2c-adapter/i2c-2/2-0032/engine2_mode
echo 0 > /sys/class/leds/lp5523:r/brightness
echo 0 > /sys/class/leds/lp5523:g/brightness
echo 0 > /sys/class/leds/lp5523:b/brightness

exit 1
;;
*)
$LOGGER -pdaemon.crit 'precharge -> failure'
# some mystery failure, continue startup
;;
esac
fi
end script

script
set +e
$LOGGER -pdaemon.notice 'start'
exec /usr/sbin/bme_RX-51
end script

# create flag file if bme is stopped on purpose (via upstart)
pre-stop script
set +e
$LOGGER -pdaemon.notice 'pre-stop'
touch $STOP_FLAG
end script

# reboot the device if flag file is not present (bme crashed)
post-stop script
set +e
$LOGGER -pdaemon.notice 'post-stop'
if [ -e $STOP_FLAG ]; then
rm $STOP_FLAG
else
$LOGGER -pdaemon.crit "crash detected -> rebooting"
/usr/sbin/dsmetool --reboot
fi

end script

Last edited by blue_led; 2010-05-13 at 19:59.
 

The Following 2 Users Say Thank You to blue_led For This Useful Post:
MohammadAG's Avatar
Posts: 2,473 | Thanked: 12,265 times | Joined on Oct 2009 @ Jerusalem, PS/IL
#857
Originally Posted by blue_led View Post
look into /etc/bme & /etc/event.d/bme.dpkg-new
at the end of bme f* script !

# reboot the device if flag file is not present (bme crashed)
post-stop script
set +e
$LOGGER -pdaemon.notice 'post-stop'
if [ -e $STOP_FLAG ]; then
rm $STOP_FLAG
else
$LOGGER -pdaemon.crit "crash detected -> rebooting"
/usr/sbin/dsmetool --reboot
fi

end script
[/COLOR][/I]
Mentioned that on #maemo over the IRC, no idea if joerg_rw checked it out or not
 
Posts: 162 | Thanked: 24 times | Joined on Feb 2010 @ Essex, UK
#858
Thanks all of you! I have no idea what anyone is talking about, but it looks like some real progress is being made
__________________
"But when you’re living on the bleeding edge, you should not be surprised when you do, in fact, bleed."
 
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#859
Originally Posted by MohammadAG View Post
Mentioned that on #maemo over the IRC, no idea if joerg_rw checked it out or not
I looked into that by going over the results of 'grep bme /etc', so I was of course aware of that. Why do you think I suggested 'stop bme', and why I suggested to Titan (and others) to remove bme references in init.d/upstart-event scripts?
It's pretty clear bme needs to be started first, if it wants to tear down the device. So if we don't start it in init/upstart it probably won't reboot the kernel.

I'm a little unsure though about that (from top):
[2010-05-13 16:25:28] <DocScrutinizer> t-tan: [2010-05-13 00:41:14] <DocScrutinizer> PP:hald-runer PID:821 hald-addon-usb-cable: listening on /sys/devices/platform/musb_hdrc/usb1/../mode

I.E. we don't know what relies on a working BME and in which way.

There's one thing we can be sure though: battery will not explode or otherwise be killed when there's no bme. The bq24150 will wake up to sane safe defaults like max USB current 100mA, max battery charge voltage 3.7V, and it should start charging with these parameters, for at least 32min ("recover from flat battery" scheme). With a little luck (and support from a correctly configured 1707 PHY chip) the bq24150 will detect a dedicated charger (D+/- short) and crank up max USB current to 500mA. But no matter if it starts charging, and at which rate - it never will overcharge the battery unless there's a bme forcing it to do that. So removing / replacing bme is as safe as any other software project, you can do nasty things if you *want*, but they won't happen by accident. A failing or nonexistent bme will NOT cause any hazard.

/j

Last edited by joerg_rw; 2010-05-14 at 02:22.
 

The Following 6 Users Say Thank You to joerg_rw For This Useful Post:
Posts: 992 | Thanked: 995 times | Joined on Dec 2009 @ California
#860
Originally Posted by egoshin View Post
Success!

I just was able to mount USB stick via self-powered HUB and read it.

Device - /dev/sda1

Details will be later, but now - modified kernel. I am looking into right modification.
If you want repeat a test, some detailed explanation is here:

A. You need a modified kernel build from 2.6.28-20100903+0m5. A default kernel configuration arch/arm/configs/rx51_defconfig should be modified:

1 - remove CONFIG_USB_OTG_WHITELIST and CONFIG_USB_OTG_BLACKLIST_HUB options.

2 - Apply an attached patch (u.txt) to kernel sources.

3 - Build a kernel.

B. Boot a kernel

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/driver/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".

F. After some time the scanning finishes and you may execute

mount /dev/sda1 /mnt

(check /dev/sda1 first!)

Viola!

If somebody could repeat it - it would be a very good information, I worries about some HW differences or wrong setup of D+/D-.

I also attach a copy of my log for reference (a lot of debug output here).

Note: ke_recv has some problem with storage recognition and it is a reason why a manual mount is needed. Don't forget to unmount before cable detachment. Or just switch N900 OFF.
Attached Files
File Type: txt u.txt (1.5 KB, 256 views)
File Type: gz log.txt.gz (2.9 KB, 150 views)

Last edited by egoshin; 2010-05-17 at 17:49. Reason: file name (drivers --> driver)
 

The Following 17 Users Say Thank You to egoshin For This Useful Post:
Closed Thread

Tags
awesomeness in the works, boulevard of broken deals, host, i am the dealbreaker, inspector gadget lies, mobidapter is a scam, nokia fanbois, otg, over 9000, usb, usbcontrol

Thread Tools

 
Forum Jump


All times are GMT. The time now is 16:17.