| Prev |   3     4   5 |
maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900) (https://talk.maemo.org/showthread.php?t=44576)

aspidites 2010-02-22 18:53

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 541481)
hmmmm wonder if i can include this as an import to auto-download the tools on install?

Or just add "gstreamers-tools" to the dependencies... ;-)

noobmonkey 2010-02-22 18:54

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by aspidites (Post 541500)
Or just add "gstreamers-tools" to the dependencies... ;-)


ooo can i? - easy as that? :D

aspidites 2010-02-22 18:55

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
er...gstreamer-tools, sorry. (notice the s removed aftger streamer)

mackan1 2010-02-23 06:15

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
got it working last night but front camra not working on it. looks nice tho

noobmonkey 2010-02-23 08:37

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by mackan1 (Post 542151)
got it working last night but front camra not working on it. looks nice tho


cool, which version are you using?

if you try the previous gstreamer command in x-term, do you get any error messages?

mackan1 2010-02-23 08:56

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
i have version 0.5.0-2

just opend it agen the front cam does work but is very dark

all you will have to do now is add a tab to free the space in the root, like moves fonts and so on.

noobmonkey 2010-02-23 20:21

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
could someone qive me a few lines of code please?! google is being rubbish!
just need to add a qlistwidget or equivalent with 2 columns and know how to add values to it.

fatalsaint 2010-02-23 20:25

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
QTableView would probably be used for that instead...

http://www.saltycrane.com/blog/2007/...acttablemodel/

http://qt.nokia.com/doc/4.0/qtableview.html

noobmonkey 2010-02-23 20:28

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by fatalsaint (Post 543226)

perfect! new version will be in sexy tables on a few tabs with a big camera image!!

mackan1 2010-02-25 06:13

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
i see there has been 2 new updates sins ur last post. anything new?

noobmonkey 2010-02-25 07:47

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by mackan1 (Post 545374)
i see there has been 2 new updates sins ur last post. anything new?


yup :) Bigger fonts and attempting to show Firmware version in an understandable way :) (So PR 1.1 etc....

mackan1 2010-02-25 09:45

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
lovein the bigger fonts,

is the front cam alwasy dark and back to front? or is it just my one

noobmonkey 2010-02-25 09:47

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by mackan1 (Post 545552)
lovein the bigger fonts,

is the front cam alwasy dark and back to front? or is it just my one

Allways dark :( - works ok outside i find :)

Back to front? - it acts as a mirror image i think.

mackan1 2010-02-26 05:51

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Hey. nice update but system reboot does not work. i think also a bigger button would also be nicer to tuch. when more tools come in to the system that is

noobmonkey 2010-02-26 08:31

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
hiMackan, sorry doing the updates in the other post :) - getting a bit confusing having it in two!

Was just a quick test, works on mine, but i'll figure out why not on others :)

No idea what i'm putton on that page yet, so not concentrating on layout until i know what i need to lay out.

noobmonkey 2010-02-26 16:11

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Hey everyone, coding question....

Looking at calling some commands that need root on the device....
running this command on my phone via my python app works... but doesn't seem to work elsewhere....

Code:

sudo /sbin/reboot
Should i
a) not be calling commands like this.... (Would kinda scupper my plans!!)
b) be doing it a different way
c) something else... lol

Rob1n 2010-02-26 16:17

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 547743)
Hey everyone, coding question....

Looking at calling some commands that need root on the device....
running this command on my phone via my python app works... but doesn't seem to work elsewhere....

Code:

sudo /sbin/reboot
Should i
a) not be calling commands like this.... (Would kinda scupper my plans!!)
b) be doing it a different way
c) something else... lol

It works here as well - it may depend on rootsh having been installed.

noobmonkey 2010-02-26 16:17

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by Rob1n (Post 547750)
It works here as well - it may depend on rootsh having been installed.

ahhhh - works via my app, or works by running it in terminal?

Rob1n 2010-02-26 16:19

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 547751)
ahhhh - works via my app, or works by running it in terminal?

Works via your app.

fatalsaint 2010-02-26 17:06

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
I think that will depend if you guys have modified your sudoers file for something else previously.

Normally I don't think running sudo "command" on the N900 will work even with rootsh..

Rootsh allows you to run "sudo gainroot" to get root, then the command. Sudo <commands> still ask for a password (in my understanding.)

So what you would want normally I think would be something like:

Code:

echo /sbin/reboot | sudo gainroot
and depend your app on rootsh.. although I don't think depending on rootsh is a good idea.

There must be some kind of API in dbus or somewhere to tell the device to reboot properly instead of running shell commands.

qwerty12 2010-02-26 17:09

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by fatalsaint (Post 547843)
although I don't think depending on rootsh is a good idea.

Precisely. Place a file in /etc/sudoers.d with a command that you want whitelisted for running as root via sudo (standard sudoers syntax), instead, and run "update-sudoers" in the postinst and postrm scripts of the package.

Quote:

Originally Posted by fatalsaint (Post 547843)
There must be some kind of API in dbus or somewhere to tell the device to reboot properly instead of running shell commands.

Code:

run-standalone.sh dbus-send --system --type=method_call --dest="com.nokia.mce" --print-reply "/com/nokia/mce/request" com.nokia.mce.request.req_reboot
Put the equivalent of that into your favourite solution for using D-Bus in an app (DBus-GLib, libosso, python-osso, python-dbus, libdbus, QDBus, ..)
http://maemo.org/api_refs/5.0/5.0-fi...-names_8h.html explains some more of the method calls available to you.

noobmonkey 2010-02-26 17:16

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
wow very helpful :D - just need to understand Dbus now! ... hmmmmmm

noobmonkey 2010-02-26 17:18

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
getting a dbus.error.UnknownMethod "req_reboot" with signature "" on interface "com.nokia.mce.request" doesn't exist.

qwerty12 2010-02-26 17:22

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 547857)
getting a dbus.error.UnknownMethod "req_reboot" with signature "" on interface "com.nokia.mce.request" doesn't exist.

Apologies. It got moved to DSME. Try:
Code:

run-standalone.sh dbus-send --system --type=method_call --dest="com.nokia.dsme" --print-reply "/com/nokia/dsme/request" com.nokia.dsme.request.req_reboot

noobmonkey 2010-02-26 17:25

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by qwerty12 (Post 547861)
Apologies. It got moved to DSME. Try:
Code:

run-standalone.sh dbus-send --system --type=method_call --dest="com.nokia.dsme" --print-reply "/com/nokia/dsme/request" com.nokia.dsme.request.req_reboot

Lol - don't apologise - by getting it wrong you did actually force me to hunt the answer out :)

Just tested it and works fine! - wohooo! :D - slowly getting there - i think i've bitten of a little mor ethen i should have for my first project - but it is still fun!!

noobmonkey 2010-02-26 17:27

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
But you have got me wanting to test this bit now!!

Vibrator interface D-Bus methods
:D :D :D

noobmonkey 2010-02-26 17:35

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Qwerty... thats got me thinking, as i have a load of other commands i'd like to run.... - may be best for me to seek alternatives...

apt-get clean
apt-get install pymaemo-optify (possibly)

even looking at using the cleanup script to run externally as part of the application....
Code:

#!/bin/sh
# Nokia N900 Maemo 5 Script to free up space on rootfs
# ignoring errors when creating dirs that may already exist

# Moving themes to /home/opt
mkdir -p /home/opt/usr/share/themes 2> /dev/null
cp -r /usr/share/themes/* /home/opt/usr/share/themes
rm -r /usr/share/themes
ln -s /home/opt/usr/share/themes /usr/share/themes

# Moving ?? icons to /home/opt
mkdir -p /home/opt/usr/share/icons 2> /dev/null
cp -r /usr/share/icons/* /home/opt/usr/share/icons
rm -r /usr/share/icons
ln -s /home/opt/usr/share/icons /usr/share/icons

# Moving video on start-up to /home/opt
mkdir -p /home/opt/usr/share/hildon-welcome 2> /dev/null
cp -r /usr/share/hildon-welcome/* /home/opt/usr/share/hildon-welcome
rm -r /usr/share/hildon-welcome
ln -s /home/opt/usr/share/hildon-welcome /usr/share/hildon-welcome

# ??
mkdir -p /home/opt/usr/share/pixmaps 2> /dev/null
cp -r /usr/share/pixmaps/* /home/opt/usr/share/pixmaps
rm -r /usr/share/pixmaps
ln -s /home/opt/usr/share/pixmaps /usr/share/pixmaps

# Moving 'apt cache' to /home/opt - Valid until Bug 5746 is fixed.
mkdir -p /home/opt/var/cache/apt 2> /dev/null
cp -r /var/cache/apt/* /home/opt/var/cache/apt
rm -r /var/cache/apt
ln -s /home/opt/var/cache/apt /var/cache/apt


fatalsaint 2010-02-26 18:24

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by qwerty12 (Post 547861)
Apologies. It got moved to DSME. Try:
Code:

run-standalone.sh dbus-send --system --type=method_call --dest="com.nokia.dsme" --print-reply "/com/nokia/dsme/request" com.nokia.dsme.request.req_reboot

I knew it existed.. just couldn't look it up.

Thanks for the save.

noobmonkey 2010-02-26 19:23

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Is this call still valid?

Just not returning anything for me?
Code:

run-standalone.sh dbus-send --system --type=signal /com/nokia/mce/signal com.nokia.mce.signal.sig_device_orientation_ind

noobmonkey 2010-02-26 19:34

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
hmmm does nothing at all in terminal either.... am i missing an import?!

noobmonkey 2010-02-28 13:45

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
ok, right tidied up the app ready to lean this bit.....
I'm going to sound incredibly noobish... (Tis all in the name i say!)......

Quote:

Precisely. Place a file in /etc/sudoers.d with a command that you want whitelisted for running as root via sudo (standard sudoers syntax), instead, and run "update-sudoers" in the postinst and postrm scripts of the package.
I'm assuming that means for example if i want to run apt-get clean
It needs to be added somehow to /etc/sudoers.d


Not sure what you mean by -
Quote:

run "update-sudoers" in the postinst and postrm scripts of the package.
My package is pretty simple... 2 py files and the usual desktop, service and icons...

fred123 2010-02-28 14:38

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
two files in debian control

postinst & postrm
Code:

#!/bin/sh

#update sudoers

update-sudoers

create the following file

etc/sudoers.d/healthcheck.sudoers
Code:

user ALL = NOPASSWD: /<path>/command
put all the commands you need to run as root.

this will allow commands to be run as root when your package is installed, and stopped when package is removed.

noobmonkey 2010-02-28 15:03

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by fred123 (Post 549890)
two files in debian control

postinst & postrm
Code:

#!/bin/sh

#update sudoers

update-sudoers

create the following file

etc/sudoers.d/healthcheck.sudoers
Code:

user ALL = NOPASSWD: /<path>/command
put all the commands you need to run as root.

this will allow commands to be run as root when your package is installed, and stopped when package is removed.



wow thank you!!!!

noobmonkey 2010-02-28 15:32

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
ok... getting there i think now...
SO for example my sudoers file would for example look like this?

user ALL = NOPASSWD: /apt-get %users ALL = NOPASSWD: /sbin/reboot

i'm assuming id i put apt-get in there, i can use all apt-get commands if needed?
(Just tring to find apt-get so i can put it in the right path...


Now.....
Quote:

two files in debian control

postinst & postrm
No idea what you mean, as when i package i then use autobuilder - and tbh - never heard of debian control etc... (Really new to linux and python, sorry)

But the code looks just like something i need to put in a file!..
Code:

#!/bin/sh

#update sudoers

update-sudoers

So am i right i nthinking i need to create a postinst & postrm file with this code in it? ... if so, where do i put these files, and how to they get run? (Auto by app manager?)


Sorry for the multiple q's!

fred123 2010-02-28 16:48

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

user ALL = NOPASSWD: /apt-get %users ALL = NOPASSWD: /sbin/reboot
Code:

user ALL = NOPASSWD: /apt-get
user ALL = NOPASSWD: /sbin/reboot

one command per line

postinst & postrm go in /DEBIAN folder in your package folder structure.

I am just starting with linux development as well, used to do .net dev on windows this quite different!

noobmonkey 2010-02-28 16:55

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
w00000p thank you! :D :D - will work on this tomorrow :) :) yay!

noobmonkey 2010-02-28 20:50

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
hmmmmm need some help peoples... (no change here then!)

At the moment i read the firmware versions and return something like PR1.1 - or PR1.1.1 ....
Quite easy to do at the moment... but i will hit a snag when new firmware versions come out, as i will have to update the code, then wait the 10+ days to get it out to people.... Not much help...

A few way rounds i can think of are....
Listing the versions on my website and parsing it directly from there (not good if people dont have or want to use the internet.)

or

Giving the user the ability to download a text file with them listed in, and update when they want.

Are there any other ways people can think off? or any previous good examples?

squirreluk 2010-03-06 06:37

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
hi, cant upgrade tp latest version as it say i need audiopulse installed.

mikec 2010-03-07 08:43

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
Quote:

Originally Posted by noobmonkey (Post 550253)
hmmmmm need some help peoples... (no change here then!)

At the moment i read the firmware versions and return something like PR1.1 - or PR1.1.1 ....
Quite easy to do at the moment... but i will hit a snag when new firmware versions come out, as i will have to update the code, then wait the 10+ days to get it out to people.... Not much help...

A few way rounds i can think of are....
Listing the versions on my website and parsing it directly from there (not good if people dont have or want to use the internet.)

or

Giving the user the ability to download a text file with them listed in, and update when they want.

Are there any other ways people can think off? or any previous good examples?


you could parse the firmware download site, which should
be upto date within 24 hours of OTA. ?

noobmonkey 2010-03-07 08:56

Re: [Maemo 5] HealthCheck - Pymaemo/Qt - Learning to code (N900)
 
hehe. i would have no idea where to start on that one. didnt realise you could pull off a list from there? good idea though!!


| Prev |   3     4   5 |
All times are GMT. The time now is 19:33.

vBulletin® Version 3.8.8