петък, 11 декември 2009 г.

Bluetooth slackware logitech hidd devices

MX5000
1. Unplug USB dongle
2. Press and hold RED BUTTON
3. Plug usb back

lsusb - on terminal - mus see sometig like that ot without

Bus 005 Device 007: ID 046d:0b02 Logitech, Inc. BT Mini-Receiver (HID proxy mode)

edit: "/etc/bluetooth/hcid.conf"
and add:

device 00:07:61:48:34:A2 {
name "Logitech MX1000 mouse";

}
and for keyboard too.
00:07:61:48:34:A2 - this is MAC address of Mouse that can be seen with :


edit: "/etc/bluetooth/main.conf"
and add:
DisablePlugins = network - for Slackware may be other distro too
if this not help and
hcid not load delete plugin from:
/usr/lib/bluetooth/plugins/network.so
This problem appears in some version of Bluez. If have some experience with manualy compiling try some versions from this site "http://www.kernel.org/pub/linux/bluetooth/".

edit: "/etc/rc.d/rc.bluetooth.conf" and
add or change to:
HIDD_ENABLE=true
HIDD_OPTIONS="--master --server" or
"HIDD_OPTIONS="--master --connect 00:07:61:45:AF:A3 --server"" where 00:07:61:45:AF:A3 is MAC of your mouse and keyboard that you add in
"/etc/bluetooth/hcid.conf"

HID2HCI_ENABLE=true - here is the place to say this way is the same way that Logitech use to connect devices like HIDD one. Simply You control this now, and may use Your Bluetooth dobgle for other devices let say Mobile too.
Other way is when you use :
hid2hci -v046d -pc709 -m logitech - here i not discus this but you can try it.

restart Bluetooth:
/etc/rc.d/rc.bluetooth restart - for slackware
do - and must see:
ps xa | grep hidd
15443 ? Ss 0:00 /usr/bin/hidd --master --server
and do the same for "hcid" must see him too


after that:
1. hciconfig hci0 up
2. hciconfig hci0 -a
and hcitool scan
3. hidd --search - RED BUTTON on the Mouse and Keyboard must be pressed while do that if you not have 3 hand do it one by one
4. Hold The BUTTON and hidd --connect 00:07:61:45:AF:A3 one boy one for MAuse nad Keyboard
If they are connected and your X is fine use it :).
in Some cases you must restart X or define them in x.org.
for You help use:
udevadm info -a -p `udevadm info -q path -n /dev/input/eventX` | less
to see devices "eventX" must be replaced.

After that look at the
top and see if hcid eat all your CPU kill it. In this case you not use it.

Links:
http://ubuntuforums.org/showthread.php?t=227057&page=2
https://bugs.launchpad.net/ubuntu/+source/bluez-utils/+bug/29506
http://ubuntuforums.org/showthread.php?t=594624
http://ubuntuforums.org/archive/index.php/t-325455.html
http://ubuntuforums.org/showpost.php?p=6284259&postcount=37

вторник, 8 септември 2009 г.

VIM running external commands

From :

http://www.softpanorama.org/Editors/Vimorama/vim_running_external_commands.shtml


VIM running external commands


Vim is a powerful editing tool, but there are some things it just can't do. However, Vim lets you access shell commands and utilities without leaving Vim, and that lets you perform some amazing tricks.


If you run :shell or just :sh while you're in the editor, Vim (or Gvim, if you're partial to Vim's GUI) will place you in an interactive shell. You can run whatever commands you want, and resume your Vim session by exiting the shell.

As most other *nix applications, you can also pause Vim with Ctrl-z, which will drop you back to the shell. When you're finished, you can resume Vim with fg. (This is a feature of the shell, not a Vim feature.)

Have you ever started editing a file, made a bunch of changes, and then typed :w to write your changes, only to find that the file is read-only? You can deal with that in a couple of ways, but one of the easiest things to do is to invoke a shell from within Vim and change the file's permissions before you save it again.

Bang!

Vim also allows you to execute a command directly from the editor, without needing to drop to a shell, by using bang (!) followed by the command to be run. For instance, if you're editing a file in Vim and want to find out how many words are in the file, run

:! wc %

This tells Vim to run the file (%) through the wc utility and report the results. Vim will display the command output at the bottom of the editing window until you press Enter. Note that this command runs the file through the command, and not the contents of the buffer -- so if you haven't saved recently, it won't report your most recent word count.

Bang works best with non-interactive commands. You wouldn't want to run top or another interactive command using :! command , but you could drop to a shell and run such a command with :sh or Ctrl-z.

The bang command can be useful if you're using Vim for programming. If you're writing a PHP script, for example, you could use PHP's syntax check option (-l) to see if your script has any syntax errors:

:! php5 -l %

If you're working on a script or project, you might want to check it regularly, and with minimal typing. You can scroll through Vim's command history by using the up arrow, but if you just want to rerun the last external command, you can use :!! instead.

Reading command output

Most Vim users are already familiar with using the read command, which inserts text from a specified file into the current buffer, like so:

:r textfile

This is handy, but many users aren't aware that you can also read in the output of shell applications. For example, if you wanted to include a list of files from a specific directory, you could include them using this read command:

:r ! ls -1 /home/user/directory

This tells Vim to execute the command ls -1 /home/user/directory and then redirect the output of that command into the buffer. You could also use this feature to read the text from a Web page into the file that you're editing, using a text-mode browser such as w3m. It's pretty simple to grab a page using w3m and dump it right into your editing session without leaving Vim:

:r ! w3m http://en.wikipedia.org/wiki/Vi -dump

The -dump option tells w3m to simply spit out the Web page as plain text and exit.

It's also possible to execute multiple commands to process your text before reading it into Vim. A simple example would be to list the directory contents, then pipe the output to the sort command to sort the filenames in reverse order, before inserting the text into the current buffer:

:r ! ls -1 /home/user/directory | sort -r

The read command can also come in handy if you're prepping an incident report from server logs. Let's say you wanted to include all of the errors in an Apache log that include a specific string. You could grep the log and insert the input into your Vim session:

:r ! grep string /var/log/apache2/site-error.log

Vim makes it easy to redirect the output of most standard *nix utilities into a file, and to pipe text from the file it's editing into standard *nix utilities.

Filtering text through external filters

While in Vim, you can select a range of text and run that text through an external command. In visual mode, just highlight the text you want to work with, then run :! commandname . The highlighted text will be replaced by the output of the command. Let's say you wanted to use weak encryption on part of a file by running it through the rot13 utility. Use v, V, or Ctrl-v to enter the visual mode of your choice and select the text you want to encrypt. Then run :! rot13 to replace the selected text with rot13-encoded text. This might be handy when composing an email containing a spoiler about the latest episode of Battlestar Galactica for sending to a mailing list. It's trivial for recipients to decode rot13-encoded text, but the folks who don't like spoilers won't have any surprises ruined by skimming over the text.

You can also specify a range of lines to process, rather than selecting lines in visual mode. For instance, to filter lines 20 through 25 of a file through rot13:

:20,25 ! rot13

Vim will run the text through rot13 and insert it in place of the existing text. If you accidentally overwrite some text in Vim that you didn't mean to, don't worry -- Vim's undo command (u) allows you to restore the original text.

Using a different shell

By default, Vim should use your default shell. If you want to make sure that Vim's using your default shell, you can check the value of the shell option by running this query:

:set shell ?

Vim will display shell=/bin/bash, or whatever the shell is set to. Note that this works with other options as well, so you can use :set option ? to check the value of any option within Vim.

If you'd like to change the value of the shell temporarily, run :set shell=/path/to/shell with the correct path to your chosen shell. For instance, on Ubuntu, if you want to use the Korn shell, you can run :set shell=/usr/bin/ksh -- assuming you have the Korn shell installed.

To make the change of shells permanent, open your ~/.vimrc and add this line:

set shell=/path/to/shell

The next time you start a Vim session, the new shell option will be set.

Get in the habit of using Vim's :shell command and the :! utility, and you'll find that you can be even more productive while using Vim than you might have thought possible.

Related Links

Last 5 articles by this author:

VIM Tip of the Day: running external commands in a shell

A common sequence of events when editing files is to make a change and then need to test by executing the file you edited in a shell. If you're using vim, you could suspend your session (ctrl-Z), and then run the command in your shell.

That's a lot of keystrokes, though.

So, instead, you could use vim's built-in "run a shell command"!

:!{cmd} Run a shell command, shows you the output and prompts you before returning to your current buffer.

Even sweeter, is to use the vim special character for current filename: %

Here's ':! %' is in action!


A few more helpful shortcuts related to executing things in the shell:

  • :! By itself, runs the last external command (from your shell history)
  • :!! Repeats the last command
  • :silent !{cmd} Eliminates the need to hit enter after the command is done
  • :r !{cmd} Puts the output of $cmd into the current buffer

Selena Deckelmann at 11:09

6 comments:

depesz said...
you can also use "%!" to pass current buffer via some filtering command.

For example : %!nl - to number lines (different from :set nu), :%!wc to check word count on current buffer, :%!tac to reverse order of lines, and so on.
Jon Jensen said...
Yes, and you can also send line ranges rather than the whole buffer, for example, lines 4-7:

:4,7! sort -u

or line 4 through end of file:

:4,$! sort -u

And when a visual selection is active, that will automatically be the range used:

:! sort -u
Christopher Nehren said...
And in a homologous fashion, one can read the results of an external command by passing the command to run to the :r command like so:

:r !/bin/ls
Jon Jensen said...
Chris, that's the final example Selena gave in the original post, isn't it?
Christopher Nehren said...
Yes, indeed. I must have missed that part somehow. Apologies for the noise.
Selena Deckelmann said...
@depesz & Jon: Yes! Sorting is one of @gorthx's (Gabrielle Roth) favorite uses :)

Thanks for sharing!

Old News

InformIT Basic vi Skills for the Linux LPIC Exams Advanced vi

Several tasks are part of vi that don't fit in any other section. Most of these are quite advanced, such as running external commands, joining lines, and splitting windows. This section covers these in detail.

Running External Commands in vi

A frequent question on the exams is how to run an external command inside vi, such as seeing an ls –l listing of the current directory so you can remember a filename:

:! ls –l

In this, the command ls –l executes, with the command's output displaying onscreen, and you need only press Enter or enter a command to return to the vi session. If the output scrolls more than one screen, it's piped to the more command and all the normal movement keystrokes will apply.

Joining Lines

It's quite irritating in vi to be at the front of a line and want to use the Backspace key to move that line to the end of the previous line. The Backspace key works only on the current line. If you need a line to be joined to the previous line, you can position the cursor in either line and press Shift+J to cause the second to be appended to the end of the first line.

Say you have a file named file1 that contains the following text:

This is line 1
This is a longer line 2
This is an even longer line 3

You want to join line 1 and line 2, so you position your cursor somewhere on line 1 and press the J key. The file then looks like the following:

This is line 1 This is a longer line 2
This is an even longer line 3

Putting the cursor on line 2 and pressing J joins line 2 and line 3 in a similar fashion.

Split Windows

Last, but not least, is splitting windows in vi, specifically the vim version of vi. When you're editing a particular file and want to see either another section of that same file or even another file altogether, you can use the following:

  • :split—This splits the window horizontally, with the same file and lines shown in both windows.
  • :vsplit—This splits the window on the same file vertically, with the same document shown in both the left and right panes.

Moving between the panes is somewhat counterintuitive because you must press Ctrl+W twice to move between the windows.

To edit a completely different file, you should edit the first one in vi; then to split the screen horizontally with the other file loaded in the second pane, you can enter

:split file2

To set the height of the newly split window from the split, you could enter the following:

:10split /etc/fstab

This command splits the top 10 lines of the screen and displays the contents of the /etc/fstab file therein.

If you wanted to close the split window, you would focus on it by pressing Ctrl+W and then entering

:close

Better yet, after comparing something or getting a filename straight, you can close all the other split windows and just have the current window open by entering the following:

:only

NOTE

Many times I've opened a couple of split windows to see the difference between two files or used the diff command. The easiest way to compare two files and make edits to them is to use the vimdiff command, such as

:vimdiff file1 file2

This loads the two files into a vertically split vim session and uses color and other symbols to show you what is similar or different between the two files. This is useful for comparing a log file before and after a problem or two configuration files to see why one doesn't work.

неделя, 21 юни 2009 г.

ati 9.6 kernel 2.6.30 testing

Success:

Upgrade X to current
See the picture and make changes, recompile kernel...
http://forum.ubuntu.org.cn/download/file.php?id=29624&mode=view/Screenshot-4.png
make menuconfig
...
Patch from here:
http://forum.ubuntu.org.cn/viewtopic.php?f=42&p=1329973
http://forum.ubuntu.org.cn/download/file.php?id=68780&sid=3b5c9a64a3d77c9f34a47330b7654885
I think any patch will do thing... for 2.6.30 or 2.6.29

This may need too:
patches from: http://bugs.gentoo.org/show_bug.cgi?id=266819
config_x86_32.patch

./ati-installer.sh 8.62 --buildpkg Slackware/All

go to: common/lib/modules/fglrx/build_mod/
copy fglrx.ko on hand to /lib/modules/2.6.30/external/
depmod -a
try load it.

In
cd packages/Slackware/x_pkg/
You must have all files need to copy in /usr/lib/ and /etc/ati ... it is full path tree just copy
- watch for module dir it will not copy because is link ot missing in Slack!
- just copy -r modules/* /usr/lib/xorg/modules/
see that all is copied right.

try to start X

"[fglrx:firegl_find_any_map] *ERROR* Invalid map handle!<3>[fglrx:drm_vm_close] *ERROR* map not found -> inconsistent kernel data!!! vma_start:0xb5b01000,handle:0xd0000000"
This will stay on dmesg but GL will work.


OLD:
Not working after startX and try openg X crash...

Reading long howto compile 9-6 Ati driver wth 2.6.30 i do this mess, that succeed for my only:

patches from: http://bugs.gentoo.org/show_bug.cgi?id=266819
config_x86_32.patch
flush_tlb_page-94.patch

from ARCH linux page: http://dev.archlinux.org/~eduardo/pkgs/
2.6.30.diff
fglrx.diff



cd /usr/src/ati/;rm -r 9.6; sh ati-driver-installer-9-6-x86.x86_64.run --extract 9.6; cd /usr/src/ati/9.6
patch -p0 < ../config_x86_32.patch
patch -p0 < ../flush_tlb_page-94.patch

cd common/lib/modules/fglrx/build_mod
patch -p0 < /usr/src/ati/2.6.30.diff
cp 2.6.x/Makefile .
cp ../../../../../arch/x86/lib/modules/fglrx/build_mod/libfglrx_ip.a.GCC4 .
make -C /lib/modules/2.6.30/build SUBDIRS="`pwd`" ARCH=i386 modules

неделя, 14 юни 2009 г.

sendmail dspam

wget http://download.softpedia.ro/dl/c0f5caa13850ef0c849d535a2934cbc4/4a327a61/500005125/linux/dspam-3.8.0.tar.gz
Sorry GIT is more comftable late i will get him. now wget is simple.

dspam install - like in: http://dspamwiki.expass.de/Installation/Sendmail

after that change : chmod 2777 /vard/spam
dsapm works perfect wit little addon's.

неделя, 17 май 2009 г.

Slackware Upgrade to txz package's use

download from any mirror from current in "a" are left .tgz packages that is neded:

I use this mirror "http://mirrors.unixsol.org/slackware/slackware-current/slackware/a/"
Step by step - it is important to maintain this steps,

upgradepkg slackware/ap/slackpkg-2.71.2-noarch-1.tgz - custum
upgradepkg --install-new slackware/a/xz-4.999.8beta-i486-1.tgz
upgradepkg --install-new slackware/a/gzip-1.3.12-i486-1.tgz
upgradepkg --install-new slackware/a/tar-1.22-i486-2.tgz
upgradepkg --install-new slackware/a/pkgtools-12.34567890-noarch-5.tgz

That s all.

понеделник, 30 март 2009 г.

2.6.29 no init found short

For my this was new function in kernel:

Security option->Root Plug Support->Disable

make
...
And all was OK

Now ATI 4870 wait for new drivers
ATI are fast now 9.3 was Out - no luck 2.6.29 incompatible !

събота, 28 февруари 2009 г.

KDE4 - GTK Font Fix Error was: "Gtk-WARNING **: Default font does not have a positive size"

Simply:

Must have: "Control the style and fonts used by GTK applications" in other words this: "gtk-kde4" - 74689-gtk-kde4v0.8.tar.gz

killall xfce-mcs-manager
killall gnome-settings-daemon

System Properties - System Panel - Fonts -> Choose Some Fonts NOW!. - important.
System Properties - System Panel - Use my KDE style in GTK Applications and Use my KDE Fonts
Can try different things.
RESTART APP.
If not help Repeat First step and restart again.

Cant use this for fine control: "gtk-chtheme"
Restart GTK app.

неделя, 15 февруари 2009 г.

acpi acpid and power menagement Slackware

Unfinished but if Power management troubles You it works now!

http://www.thinkwiki.org/wiki/How_to_make_use_of_Dynamic_Frequency_Scaling# - Read This

If hardly want to Read
http://www.acpica.org/downloads/index.php
http://www.lesswatts.org/projects/acpi/faq.php - can read it but it seems old

In kernel src
make menuconfig
Power management select all acpi options even is marked as depreciated

recompile restart with new kernel

acpid must be happy and started if not look at /etc/rc.d/rc.acpid and make it runnable +x

get "speedfreq" and compile

See the source below load all acpi modules
"speedstep_lib 6212 0
acpi_cpufreq 9676 0
cpufreq_userspace 3716 1
cpufreq_stats 4996 0
cpufreq_powersave 1792 0
cpufreq_ondemand 6988 0
freq_table 5376 3 acpi_cpufreq,cpufreq_stats,cpufreq_ondemand
cpufreq_conservative 6088 0
wmi 6568 0
video 16848 0
output 2880 1 video
rfkill 10828 0
input_polldev 3848 0
sbs 10568 0
sbshc 5312 1 sbs
pci_slot 4488 0
fan 4356 0
container 3392 0
battery 10052 0
ac "
This is what i load more of them are not need!

Here is mine bash function src :

### ACPI CPU
function acpi_cpu {

# ACPI & CPU modules
#
modules=`ls -q /lib/modules/2.6.28/kernel/drivers/acpi/; \
ls -q /lib/modules/2.6.28/kernel/drivers/cpufreq/; \
ls -q /lib/modules/2.6.28/kernel/arch/x86/kernel/cpu/cpufreq/;`;
for i in $modules; do
modprobe $(echo "$i"|cut -d"." -f 1);
done;
[ -x /usr/sbin/speedfreqd ] || { echo "/usr/sbin/speedfreqd - not found, exiting "; return; }
### [ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup"
speedfreqd -u # -u user can mod

echo "$? ACPI CPU FREQ Modules loaded. SpeedFreq Started";

} ### ACPI CPU END

P.S>
cpufreq - is not recommended yet - after start crash.

On most motherboards APM not work with Dual Core and etc processors if work he disable one of the cores!

see that file: /etc/acpi/acpi_handler.sh - it is ACPID default action you can change and add some functionalities.

And Now power button must PowerOff your computer.

неделя, 1 февруари 2009 г.

hunspell howto

install firefox ext dict for Your country or get dict's
find dict's.
in dir like "/home/YOURHOME/.mozilla/firefox/w8yjrjmg.default/extensions/bg-BG@dictionaries.addons.mozilla.org/dictionaries/"

become root and
copy *.aff .dic to -> /usr/share/myspell/dicts/
that's all

if see "error - iconv_open: UTF-8 -> microsoft-cp1251" after start hunspell!!!

change bg_BG.aff first line to something appropriate for iconv.
in my case:
SET windows-1251 - work fine
SET microsoft-cp1251 - don't work

Favorite MS Show by USA High Court

Main actor Bill Gates - defend IE

http://www.youtube.com/watch?v=0qNVe024RvI&feature=PlayList&p=A85534C3A9F65EC2&playnext=1&index=10

вторник, 27 януари 2009 г.

KDE4 Desktop Effects ATI Video

4830 ATI
KDE4 Desktop effect or Fusion
only not use Vsync Mplayer and TVTime blinks if on
Crash with tvtime !!! Not fixed in 9.2
Runs very well

събота, 3 януари 2009 г.

cannot execute /bin/bash: Permission Denied

After recent update from current.
when try to login as ordinary user
i see this ERROR
"cannot execute /bin/bash: Permission Denied"

easy with help from : http://linuxgazette.net/issue52/okopnik.html

find /lib -type f -perm 700 | while read i; do chmod 755 "$i"; done

startup hang stop at: Using /etc/random-seed to initialize /dev/urandom.

All was about:
rc.udev
After recent update, in /etc/rc.d has two files rc.udev and rc.udev.new
On hand You must replace old with .new
Use Live CD or what ever to mount root
go to /etc/rc.d
mv rc.udev.new rc.udev

Do it the same for rest .new files be careful
some of them can contain your changes or personal information like password and shadow, and must not be replaced!!!