Active Topics

 



Notices


Reply
Thread Tools
nicholes's Avatar
Posts: 1,103 | Thanked: 368 times | Joined on Oct 2010 @ india, indore
#11
Originally Posted by kitwalker View Post
Use it this way:

Code:
sh -c 'echo "sleep 1; echo 0 > /sys/class/backlight/acx565akm/brightness" | sudo gainroot'
i used shorcut maker and created a shortcut for this thanks!!

how can i make shortcut for python????? se my code in post #2
 
Posts: 30 | Thanked: 3 times | Joined on Jun 2010
#12
I use this way.
In your app.py python file.
Code:
import os
os.system('sh -c \'echo "sleep 1; echo 0 > /sys/class/backlight/acx565akm/brightness" | sudo gainroot\'')
I just change my code like this way. You can try it.
PS: note \'
 
nicholes's Avatar
Posts: 1,103 | Thanked: 368 times | Joined on Oct 2010 @ india, indore
#13
i don't have any .py file, i just type this in xterminal


python


import gst
bin = gst.element_factory_make("camerabin")
bin.set_property("videoenc", gst.element_factory_make("dspmp4venc"))
bin.set_property("videomux", gst.element_factory_make("hantromp4mux"))
bin.set_property("audioenc", gst.element_factory_make("nokiaaacenc"))
bin.set_state(gst.STATE_PLAYING)
bin.set_property("filename", "test.mp4")
bin.set_property("mode",1)
#starts recording
bin.emit("user-start")

# wait some time

# stops recording
bin.emit("user-stop")
bin.set_state(gst.STATE_PAUSED)
bin.set_state(gst.STATE_NULL)

this code starts n900s camera and u can lock screen while video rec.
and now i want one shortcut for this. plz help
 
Posts: 5 | Thanked: 1 time | Joined on Nov 2010
#14
Hello, since I do develop/maintain/something cmd-shortcuts I thought it good to reply.

I used to assume just typing in "sudo command" would work for most people, but realised it was because of the file /etc/sudoers.d/chroot.sudoers, added by package easy-chroot (dependency of easy-debian), containing a line allowing anything to be run as root. As a solution one might try to add something similar to:
Code:
user ALL = NOPASSWD: ALL
to a new file in /etc/sudoers.d/ (maybe cmd-shortcuts.sudoers).
Otherwise a workaround that seems to work is:
Code:
echo 'your command' | sudo gainroot
in the command field of the button/shortcut you're creating in case your setup doesn't allow just any command to be run with sudo without giving any password (don't know if this "running any command without password with sudo"-business actually is too good of an idea, but easy-chroot added it for me as I said).

I might add a checkbox "Run as root" implementing a commonly working workaround, maybe intelligently sensing what could work out of a set of alternatives even, in a future version. Hopefully I'll come around to it soon since I've started to notice other tweaks that could be useful (like having a tree structure to sort stuff out when you have many buttons). Alternatively I might do something like adding a /etc/sudoers.d/cmd-shortcuts.sudoers in the default install (hey, easy-chroot does it...).

Last edited by xantoz; 2011-09-09 at 17:20.
 
Reply


 
Forum Jump


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