The Following User Says Thank You to Wikiwide For This Useful Post: | ||
|
2014-11-30
, 23:11
|
Posts: 1,994 |
Thanked: 3,342 times |
Joined on Jun 2010
@ N900: Battery low. N950: torx 4 re-used once and fine; SIM port torn apart
|
#83
|
same error. I don't know what the problem is. Could it be a hardware problem?
The Following User Says Thank You to Wikiwide For This Useful Post: | ||
|
2014-12-01
, 06:26
|
Posts: 2,225 |
Thanked: 3,822 times |
Joined on Jun 2010
@ Florida
|
#84
|
NAC=$( $NAC * 3570 / $RS / 1000 )
NAC=$(($NAC * 3570 / $RS / 1000))
NAC=$(("$NAC" * 3570 / "$RS" / 1000))
NAC=$((NAC * 3570 / RS / 1000))
usr/sbin/bnf-i2c: line 45: syntax error: * 3570 / 20 / 1000
$ A= B=1; echo $(($A * $B)) sh: syntax error: * 1
-sh: arithmetic syntax error
i2cget -y 2 0x55 0x0c w
sudo i2cget -y 2 0x55 0x0c w
|
2014-12-01
, 07:11
|
Posts: 2,225 |
Thanked: 3,822 times |
Joined on Jun 2010
@ Florida
|
#85
|
[...]
However, while we're at it, the dollar signs (and thus doublequotes) are actually redundant. Since this is an arithmetic expansion we're working with, we can just write:
[...]Code:NAC=$((NAC * 3570 / RS / 1000))
if ! \ # VAR1=`i2cget [...]` && VAR2=`i2cget [...]` && [...] VARn=`i2cget [...]` then #error out because one of the i2cget calls failed, for example: printf "i2cget failed to load one of the necessary values.\n" >&2 fi
i2cget_wrapperWithError() { if i2cget "$@" then return $? else RET=$? printf "error: i2cget %s\n" "$*" return $RET fi }
|
2014-12-01
, 07:41
|
|
Posts: 5,028 |
Thanked: 8,613 times |
Joined on Mar 2011
|
#86
|
|
2014-12-01
, 13:57
|
Posts: 2,225 |
Thanked: 3,822 times |
Joined on Jun 2010
@ Florida
|
#87
|
@Mentalist Traceur
Thanks for your insights on the "code", all dully noted, I'll experiment with upgrading the script when I'll have some free time. BTW, that happens, when someone with actual knowledge inspects totally "noobishly" written code Well, at least I seem to *do* understand the mechanics behind your suggestions, and that is something, already...
|
2014-12-01
, 19:34
|
Posts: 2,225 |
Thanked: 3,822 times |
Joined on Jun 2010
@ Florida
|
#88
|
As a sidenote, this assumes $NAC and $RS will never have whitespace inside them (or be blank). I habitually double-quote any usage of $VAR_NAME unless I expressly know it's guaranteed to be unnecessary. So it would look like so:
..though it's not a big deal because either way you'd get a syntax error if there's whitespace in either of those variables.Code:NAC=$(("$NAC" * 3570 / "$RS" / 1000))
|
2014-12-03
, 20:42
|
Posts: 16 |
Thanked: 7 times |
Joined on Oct 2012
|
#89
|
@speedonwilliam
If the "sudo i2cget" thing doesn't produce output, try issuing it without sudo, but from root shell.
The Following User Says Thank You to speedonwilliam For This Useful Post: | ||
|
2014-12-04
, 07:25
|
|
Posts: 5,028 |
Thanked: 8,613 times |
Joined on Mar 2011
|
#90
|
The Following User Says Thank You to Estel For This Useful Post: | ||
Tags |
battery, bnf script, bq27200, bq27x00, charging |
|
$ sudo gainroot
# bnf
You need to have rootsh package installed :-)
http://wiki.maemo.org/Root
Best wishes.
~~~~~~~~~~~~~~~~~
Per aspera ad astra...