Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7284
| Date | 2011-06-09 06:50 -0400 |
|---|---|
| From | Dave Angel <davea@ieee.org> |
| Subject | Re: test_popen |
| References | <AvYHp.2346$5v5.359@newsfe11.iad> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.49.1307616666.11593.python-list@python.org> (permalink) |
On 01/-10/-28163 02:59 PM, harrismh777 wrote: > Looks like my 2.7 test_popen failure is an open issue7671... since Jan > 2010. Looks like it really does function ok. > > At any rate, I was able to test Popen myself today, and it ran fine. I > needed to write a script that will disable the touch pad on this HP g > series, because there is no way to do that in the bios. So, in > gnu/linux, you get the device id list with 'xinput list' and then to > disable the touch pad for that id, enter this command: > > 'xinput set-prop <id#> "Device Enabled" 0' > > So, I'm using Popen class to talk to the system through a shell and read > back the stdout through a pipe, and was able to retrieve the device ids > with this (in ver 2.7.1) : > > from subprocess import PIPE, Popen > cmd = 'xinput list' > p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) > stdout, stderr = p.communicate() > print stdout > > (actually I parsed it with the re module) > > The only difference here between 2.7 and 3.2 is that 3.2 gives back a > b'string' ... otherwise, same same. > > I'm parsing the ids listing with the re module and then using Popen to > issue the command to disable the touch pad. Its a little more > complicated than that, because I only allow the script to 'work' if it > finds the id=# for an attached mouse or track-ball... I use the Logitech > Trackman... otherwise it asks the double question for whether the touch > pad should be deactivated. So, clicking the icon once disables the pad, > and clicking it again re-enables it, assuming the trackman is plugged > in. The trick does not work across login-logout, so the touchpad must be > disabled in the startup, or else manually every time the user logs in. > > When I get the silly thing done I'll post it, in case anyone else is > interested... there does seem to be a lot of interest on the net for > disabling the synaptics touch pad... it just gets in the way most of the > time and isn't very efficient the rest of the time. (but I digress) > > > kind regards, > m harris > > Thanks for this. It has already helped me solve a similar problem, and in my case the problem/solution is much simpler. The xinput cmd permits you to specify the device name directly, so for my Lenovo, I can just use the shell command: sudo xinput --set-prop --type=int --format=8 "SynPS/2 Synaptics TouchPad" "Device Enabled" "0" I used the information you supplied to modify what already worked on a couple of Dells I had. What I was missing was the correct string for the Lenovo. The Dells called it "PS/2 Generic Mouse" DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
test_popen harrismh777 <harrismh777@charter.net> - 2011-06-09 00:04 -0500 Re: test_popen Dave Angel <davea@ieee.org> - 2011-06-09 06:50 -0400
csiph-web