maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   [Announce] USB hostmode beta release (https://talk.maemo.org/showthread.php?t=65232)

tutul 2011-08-21 19:21

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by MohammadAG (Post 866310)
Well, most of you don't know this, but, PR1.3 introduced two things:
Backports of new kernel patches to musb, which really helped with hostmode.
And.. a new bug, if you connect the wall charger to the device, 100% of the time it will stay on 500 (sometimes 550?) MHz, we do not know the behavior of an overclocked device when this bug is triggered on it, if it stays clocked @ 900 (for example), then we're going to see some dead devices pretty soon.
Anyways, hostmode's patches require 1.3's patches to musb, so until titan updates his kernel, it's a no go, feel free to contact his email address (see http://maemo.org/packages/view/kernel-power-flasher and click his name) and request an update.


great application.i really love this app.but i face a problem.i install power kernel and update it.than i install H-E-N.but when i connect a usb mouse,pen drive and others than my n900 show me " unable to connect,no file system available''.and some times show ''mount /dev/sda1 not found''.plz sir help me in details.as soon possible.

thanks

tutul 2011-08-21 19:23

Re: [Announce] USB hostmode beta release
 
Friends please help me....please

sicelo 2011-09-09 11:05

Re: [Announce] USB hostmode beta release
 
On my N900, after closing h-e-n, idle current draw is significantly higher than it was before using hostmode.
As per discussion here --> http://mg.pov.lt/maemo-irclog/%23mae...09-01T23:45:48
it was found that briefly connecting the device to a charger fixes the issue. Another fix that works is to execute /usr/sbin/booston while bme is running, then after about 5 seconds, you kill it and run /usr/sbin/boostoff.
EDIT: it doesn't matter whether bme is running or not. I found that out through updated booston script (see joerg_rw's post below), which stops bme automatically.

Jaekaelae 2011-09-09 11:31

Re: [Announce] USB hostmode beta release
 
I've been wondering that if i could use this function with external touch screen? is there any way to charge phone when it is in hostmode? It would be nice extend to life of my n900 after n9 comes along. I would be installing n900 and touchscreen to car. is there any idea or am i crazy? :D

sicelo 2011-09-09 11:40

Re: [Announce] USB hostmode beta release
 
as for charging while in hostmode, answer is yes. see http://talk.maemo.org/showthread.php...203#post921203

and external touchscreen, i believe it would be recognized as an input device. only issue would be how to calibrate it, etc

Estel 2011-09-11 23:53

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by joerg_rw (Post 1023402)
here an intermediate version of booston, that replaces original file and has some small goodies - a direct uncleaned copy of what's on my hostmode devel device. You might want to edit /etc/mce/mce.ini to define a new pattern "PatternVboost" signalling device is in boostmode (attached my mce.ini for an example).
Of course you may want to keep permissions and owner of original booston, and maybe you need to change the hardcoded path to ic2set in this script (the line "i2cset=/usr/local/sbin/i2cset") to your result of `which i2cset`

This is no official update but just a teaser, as I'm feeling sad with all of you while this is collecting dust on my t900.

Bear with me, a better version is about to include charging and slowly matures here...

/j

Code:

#!/bin/sh
# jrbme "just replaces bme" in fact does more than just that
# It implements FOSS charging via bq24150 and manages hostmode
# For this it implements a daemon mode which is entered by default
# when jrbme is called by user root (i.e. on system init usually)
# and which cares about keeping battery charged and about signalling
# battery charge status and other events via system dbus
# When called by any user who's not root, jrbme doesn't enter daemon
# mode. Instead it serves as a cmd interface between user and a daemonized
# instance of itself, talking to the daemon via signal and named pipes,
# and reporting back to user all result codes, messages to stdout/stderr.
#
# sed -i "s/LEDPatterns=/LEDPatterns=PatternVboost;/" /etc/mce/mce.ini
# vboost with reset on exit and (#'d) partial hostmode for PF-kernel
#(c) 20101030 J.Reisenweber

set -eu
true=true
false=""

${debug=/bin/false} && set -vx; # call like ~# debug="echo -n $0; date" script.sh

#const
PatternVboost=PatternVboost
dbus-send="/usr/bin/run-standalone.sh /usr/bin/dbus-send"
i2cset=/usr/local/sbin/i2cset

#var
: ${start_bme=true}
: ${notify=true}



trap cleanup INT QUIT TERM EXIT
cleanup(){
  trap - INT QUIT TERM EXIT

  # reset bq24150
  $i2cset -y -m 0x80 2 0x6b 0x04 0x80

  # stop LED indicator
  $dbus-send --system --type=method_call \
    --dest=com.nokia.mce /com/nokia/mce/request \
    com.nokia.mce.request.req_led_pattern_deactivate \
    string:$PatternVboost

  $debug && (
    Reg1=`$i2cget -y 2 0x6b 0x00`
    echo $Reg1
  )
 
  if [ $start_bme ]
  then
    sleep 2
    log "Starting bme"
    /sbin/start --quiet bme
  fi
  exit
}

log(){
  echo "${0}: $@"
}

logn(){
  echo -n "${0}: $@"
}

# the script body. We read in whole text, and then execute a main at end of script,
# this ensures the whole script has correct syntax and there'll be no reads at
# runtime
main(){
  log "Stopping bme"
  /sbin/stop --quiet bme
  sleep 3
  #echo host >mode
 
  # start vbus boost 5V
  $i2cset -y -m 0x07 2 0x6b 0x01 0x05;
 
  # set notification LED
  $dbus-send --system --type=method_call \
    --dest=com.nokia.mce /com/nokia/mce/request \
    com.nokia.mce.request.req_led_pattern_activate \
    string:$PatternVboost
 
  #sleep 1
  #echo F >/proc/driver/musb-hdrc

  while sleep 5; do
    Reg1=`$i2cget -y 2 0x6b 0x00`
    if [ 8 -ne $(( Reg1 & 0x0F )) ]; then
      errortext1="ERROR in VBUS supply: BQ24150-Reg1=$Reg1"
      case $(( Reg1 & 0x07)) in
        0) errortext2="No error, just stopped";;
        1) errortext2="VBUS OVERVOLTAGE - You just fried your N900";;
        2) errortext2="OVERLOAD - N900 can deliver max 200mA. VBUS got shut off";;
        3) errortext2="Battery too low. VBUS shut off";;
        4) errortext2="Battery OVP - WTF are you doing?";;
        5) errortext2="Thermal Shutdown (too hot)";;
        6) errortext2="Watchdog expired. Script sucks";;
        *) errortext2="WTF? This should not happen";;
      esac

      log "$errortext1"
      log "$errortext2"
      if [ $notify ]; then
        $dbus-send --type=method_call --dest=org.freedesktop.Notifications \
        /org/freedesktop/Notifications \
        org.freedesktop.Notifications.SystemNoteDialog \
        string:"`echo -en "Shutting down 5V supply for USB! Reason:\n$errortext2"`" uint32:0 string:"WARN"; #no idea about WARN
      fi
      cleanup
    fi
   
    # tickle watchdog timer
    $i2cset -y -m 0x80 2 0x6b 0x00 0x80;
  done
  cleanup
}
main "$@"; exit


Using this booston via terminal, I got following error:
Code:

/usr/sbin/booston: line 25: dbus-send=/usr/bin/run-standalone.sh /usr/bin/dbus-send: not found
I've checked that both '/usr/bin/run-standalone.sh' and '/usr/bin/dbus-send' are in correct place. I hope that this will help in improving this script ;)

Also, what may cause this, and, is a chance that this prevent booston for working at all = may prevent hostmode from working correctly? I don't want to assume too early - I got problems with connecting devices (that i know worked flawlessly) with new booston script, but i'm not sure if it's generic hostmode error (i.e. I need to try again few more times), or something with booston.

// Edit

Led pattern is correctly created, ho ever, it doesn't work when I use new booston (even when phone locked or screen off). I suspect it's related to dbus-send fail, ho ever, I still don't know if it prevent booston from working as whole.

Sub-edit:
It seems to me, that due to aforementioned error, new booston doesn't want to work at all on my device. I've tried multiple times to connect device, but even kernel-messages doesn't seem to show any activity on booston, no matter if called from GUI or terminal.

Resurrecting old booston fixed this, and every device, that failed with new booston, works fine now.

// Edit 2

Slightly different topic - I *may* have found something related to "generic hostmode error" (i.e. it doesn't work, and we don't know why), people are experiencing sometimes.

I've checked kernel messages in different situations, when I try to attach my (working flawlessly with HEN, normally) pendrive. Usually, when it does not want to work, it says:
Code:

Forced hostmode error: a full/low-speed device attached but high-speed mode selected
Of course pendrive in question is high-speed device for 100%. Ho ever, I noticed that, when such error appear, and I disconnect my device/adapter/cable at all (same result in every combination), then start from the beginning, kernel messages also state mentioned forced hostmode error - even when no device is attached at all!

Even restarting HEN totally doesn't make difference. If it get "stuck" like that, I've to try again and again, and, it *should* "unstuck" on n attempt. There was no situations, on which I was not able to connect my device at all (but, keep in mind, that I'm somehow stubborn one), it got to work, sooner or later. Still, I got no idea what may cause this type of error.

Of course, trying to use full-speed or low-speed also doesn't solve the problem. It just have to "unstuck". I feel that device may assume something wrong is connected, even before actual device is connected, but I may be wrong.

// Edit 3
sorry for providing so much info/text in one post, but I think it's worth mentioning without delay. Is there any "forced wait" before enabling/disabling booston, and enabling it again?

I'm asking, because, another "scenario" when hostmode reject to work properly, is when I try few devices "in a row". Initially it works, but after few device switches, it stop working, giving constant:
Code:

device descriptor read/64, error -71
I'm thinking it may be related to booston, because, normally, when you call booston, a:
Code:

twl4030_usb twl4030_usb: HW_CONDITIONS 0x50/80: link 1
...appear in kernel messages. Ho ever, when such error situation occur, there is no info about twl4030_usb anywhere in log. I've also tried to just enable booston, without actually connecting and enumerating device - it just doesn't appear to do anything. If i left device alone for few minutes, it work again as it should, and booston result in twl4030_usb info popping up.

I think it may be also responsible for high ammount of user-case fails with hostmode - if people constantly try to connect device, booston doesn't get "unstuck".

joerg_rw 2011-09-12 03:47

Re: [Announce] USB hostmode beta release
 
please get a fixed version of augmented booston from http://maemo.cloud-7.de/maemo5/usr/sbin/booston

sorry for the glitches that sneaked in

[edit]
(yet untested) commands for your convenience:

Code:

root
cd /usr/sbin
mv booston "booston-backup-`date`"
wget http://maemo.cloud-7.de/maemo5/usr/sbin/booston
chmod a+x booston

echo "new booston should be ready to use now"


/j

Estel 2011-09-12 16:12

Re: [Announce] USB hostmode beta release
 
Huge thanks joerg_rw, but could You tell me - it was related to my device, or every "generic" user should get this problem? I.E, it was not reported, cause no one dared to test it before, or it's just fault of my configuration?

// Edit

with updated booston, hostmode works like a charm. Ho ever, for some reasons LED indicator doesn't show that device is in vboost mode - no matter if it's locked, unlocked but screen off etc.

I got correct (otherwise working, tested with LED Patterns editor) PatternVboost. It seems that it's just not used.

Anyway, here is my pattern, in case someone may find any error I wasn't able to spot:
Code:

PatternVboost=35;4;0;Rb;9d8040004817e0044807431e7e007e0042000000;9d804000e080421e431e0000

biketool 2011-09-13 04:26

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by Estel (Post 1086924)
with updated booston, hostmode works like a charm.

OK since you have it working and tested what is the short path to the fix? I tried the new booston and that didn't fix it, H-E-N no connect problem started with new KP48. Thanks

joerg_rw 2011-09-13 07:39

Re: [Announce] USB hostmode beta release
 
Quote:

Originally Posted by Estel (Post 1086924)
Huge thanks joerg_rw, but could You tell me - it was related to my device, or every "generic" user should get this problem? I.E, it was not reported, cause no one dared to test it before, or it's just fault of my configuration?

It's been my fault to edit original script to fix some minor bugs (add run-standalone.sh etc) and then not testing it. Was too sure about my shell scripting fu, envs mustn't contain "-"
So no, nobody noticed that before you did :-(
/j


All times are GMT. The time now is 21:48.

vBulletin® Version 3.8.8