summaryrefslogtreecommitdiffstats
path: root/kmilo/kmilo_kvaio
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit2bda8f7717adf28da4af0d34fb82f63d2868c31d (patch)
tree8d927b7b47a90c4adb646482a52613f58acd6f8c /kmilo/kmilo_kvaio
downloadtdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.tar.gz
tdeutils-2bda8f7717adf28da4af0d34fb82f63d2868c31d.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeutils@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmilo/kmilo_kvaio')
-rw-r--r--kmilo/kmilo_kvaio/Makefile.am39
-rw-r--r--kmilo/kmilo_kvaio/README.sonypi.h18
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/Makefile.am15
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui273
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui.h15
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/kvaio.desktop146
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/main.cpp176
-rw-r--r--kmilo/kmilo_kvaio/kcmkvaio/main.h53
-rw-r--r--kmilo/kmilo_kvaio/kmilo_kvaio.cpp68
-rw-r--r--kmilo/kmilo_kvaio/kmilo_kvaio.desktop106
-rw-r--r--kmilo/kmilo_kvaio/kmilo_kvaio.h66
-rw-r--r--kmilo/kmilo_kvaio/kvaio.cpp606
-rw-r--r--kmilo/kmilo_kvaio/kvaio.h113
-rw-r--r--kmilo/kmilo_kvaio/kvaiodriverinterface.cpp221
-rw-r--r--kmilo/kmilo_kvaio/kvaiodriverinterface.h62
-rw-r--r--kmilo/kmilo_kvaio/sonypi.h158
16 files changed, 2135 insertions, 0 deletions
diff --git a/kmilo/kmilo_kvaio/Makefile.am b/kmilo/kmilo_kvaio/Makefile.am
new file mode 100644
index 0000000..a711565
--- /dev/null
+++ b/kmilo/kmilo_kvaio/Makefile.am
@@ -0,0 +1,39 @@
+# This file is part of the KDE project
+# Copyright (C) 2003 George Staikos <staikos@kde.org>
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+SUBDIRS = . kcmkvaio
+
+INCLUDES=-I$(srcdir)/../kmilod $(all_includes)
+
+kde_module_LTLIBRARIES = kmilo_kvaio.la
+
+kmilo_kvaio_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kmilo_kvaio_la_LIBADD = ../kmilod/libkmilo.la $(LIB_KIO) -lXext -lXtst
+kmilo_kvaio_la_SOURCES = kmilo_kvaio.cpp kvaiodriverinterface.cpp kvaio.cpp
+
+METASOURCES = AUTO
+
+KDE_OPTIONS = nofinal
+
+noinst_HEADERS = kmilo_kvaio.h kvaiodriverinterface.h kvaio.h
+
+services_DATA = kmilo_kvaio.desktop
+servicesdir = $(kde_servicesdir)/kmilo
+
+messages:
+ $(XGETTEXT) $(kmilo_kvaio_la_SOURCES) -o $(podir)/kmilo_kvaio.pot
diff --git a/kmilo/kmilo_kvaio/README.sonypi.h b/kmilo/kmilo_kvaio/README.sonypi.h
new file mode 100644
index 0000000..5940b38
--- /dev/null
+++ b/kmilo/kmilo_kvaio/README.sonypi.h
@@ -0,0 +1,18 @@
+(C) 2003, 2004: Mirko Boehm <mirko@kde.org>
+Licensed under the terms of the LGPL.
+
+This file explains the bad hack of copying the sonypi.h header file into this
+directory:
+-----------------------------------------------------------------------------
+
+Along with glibc, an outdated header snapshot is installed. The event
+definitions in include/linux/sonypi.h in newer kernels differ too much from
+it. Since the code shipped here depends on the proper event definitions, I
+decided to ship a copy of a more up to date include file here.
+
+The solution is not optimal, but it works, and I try to keep the files in this
+directory up to date.
+
+If somebody knows a better solution, please let me know at mirko@kde.org.
+
+
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/Makefile.am b/kmilo/kmilo_kvaio/kcmkvaio/Makefile.am
new file mode 100644
index 0000000..6555b6c
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/Makefile.am
@@ -0,0 +1,15 @@
+kde_module_LTLIBRARIES = kcm_kvaio.la
+
+kcm_kvaio_la_SOURCES = kcmkvaio_general.ui main.cpp
+
+kcm_kvaio_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+kcm_kvaio_la_LIBADD = ../kvaiodriverinterface.lo $(LIB_KDEUI)
+
+INCLUDES= $(all_includes)
+
+kcm_kvaio_la_METASOURCES = AUTO
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kcmkvaio.pot
+
+xdg_apps_DATA = kvaio.desktop
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui b/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui
new file mode 100644
index 0000000..ac376f3
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui
@@ -0,0 +1,273 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KCMKVaioGeneral</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>KCMKVaioGeneral</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>536</width>
+ <height>226</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>KVaio: General Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlOff</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <property name="text">
+ <string>Cannot find the &lt;i&gt;Sony Programmable Interrupt Controller&lt;/i&gt;. If this is a Sony Vaio Laptop, make sure the &lt;b&gt;sonypi&lt;/b&gt; driver module loads without failures.</string>
+ </property>
+ </widget>
+ <widget class="QFrame">
+ <property name="name">
+ <cstring>frameMain</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>bgBattery</cstring>
+ </property>
+ <property name="title">
+ <string>System Power</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>mTLBattery</cstring>
+ </property>
+ <property name="text">
+ <string>Remaining battery capacity:</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignRight</set>
+ </property>
+ </widget>
+ <widget class="KProgress">
+ <property name="name">
+ <cstring>mKPBattery</cstring>
+ </property>
+ </widget>
+ <widget class="KLed">
+ <property name="name">
+ <cstring>kledAC</cstring>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="shape">
+ <enum>Rectangular</enum>
+ </property>
+ <property name="color">
+ <color>
+ <red>0</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlAC</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>AC</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ </widget>
+ <widget class="KLed">
+ <property name="name">
+ <cstring>kledBat1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="shape">
+ <enum>Rectangular</enum>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlBat1</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Bat 1</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ </widget>
+ <widget class="KLed">
+ <property name="name">
+ <cstring>kledBat2</cstring>
+ </property>
+ <property name="state">
+ <enum>Off</enum>
+ </property>
+ <property name="shape">
+ <enum>Rectangular</enum>
+ </property>
+ <property name="look">
+ <enum>Raised</enum>
+ </property>
+ <property name="color">
+ <color>
+ <red>255</red>
+ <green>255</green>
+ <blue>0</blue>
+ </color>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>tlBat2</cstring>
+ </property>
+ <property name="font">
+ <font>
+ </font>
+ </property>
+ <property name="text">
+ <string>Bat 2</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>bgGeneral</cstring>
+ </property>
+ <property name="title">
+ <string>Other Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>mCbPowerMsgs</cstring>
+ </property>
+ <property name="text">
+ <string>Periodically inform about battery and AC adapter status</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>mCbBackButtonMsg</cstring>
+ </property>
+ <property name="text">
+ <string>Show battery and AC status on Back button press</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>cbReportUnknownEvents</cstring>
+ </property>
+ <property name="text">
+ <string>Report unhandled events using On Screen Display</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>cbReportUnknownEvents</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>KCMKVaioGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>mCbPowerMsgs</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>KCMKVaioGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+ <connection>
+ <sender>mCbBackButtonMsg</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>KCMKVaioGeneral</receiver>
+ <slot>slotChanged()</slot>
+ </connection>
+</connections>
+<includes>
+ <include location="local" impldecl="in implementation">kcmkvaio_general.ui.h</include>
+</includes>
+<signals>
+ <signal>changed();</signal>
+</signals>
+<slots>
+ <slot>slotChanged()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>kprogress.h</includehint>
+ <includehint>kled.h</includehint>
+ <includehint>kled.h</includehint>
+ <includehint>kled.h</includehint>
+</includehints>
+</UI>
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui.h b/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui.h
new file mode 100644
index 0000000..96d4938
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/kcmkvaio_general.ui.h
@@ -0,0 +1,15 @@
+/****************************************************************************
+** ui.h extension file, included from the uic-generated form implementation.
+**
+** If you wish to add, delete or rename functions or slots use
+** Qt Designer which will update this file, preserving your code. Create an
+** init() function in place of a constructor, and a destroy() function in
+** place of a destructor.
+*****************************************************************************/
+#include <kdialog.h>
+
+void KCMKVaioGeneral::slotChanged()
+{
+ emit(changed());
+}
+
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/kvaio.desktop b/kmilo/kmilo_kvaio/kcmkvaio/kvaio.desktop
new file mode 100644
index 0000000..12be7eb
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/kvaio.desktop
@@ -0,0 +1,146 @@
+[Desktop Entry]
+Type=Application
+Exec=kcmshell kvaio
+Icon=laptop
+DocPath=kcontrol/kvaio/index.html
+
+X-KDE-Library=kvaio
+X-KDE-ParentApp=kcontrol
+
+Name=Sony Vaio Laptop
+Name[ar]=حاسوب سونى فايو المحمولة
+Name[bg]=Лаптоп Sony Vaio
+Name[br]=Hezoug Sony Vaio
+Name[bs]=Sony Vaio laptop
+Name[ca]=Portàtil Sony Vaio
+Name[cs]=Sony Vaio notebook
+Name[cy]=Gluniadur Sony Vaio
+Name[da]=Sony Vaio bærbar
+Name[de]=Sony Vaio Notebook
+Name[el]=Φορητός υπολογιστής Sony Vaio
+Name[es]=Portátil Sony Vaio
+Name[et]=Sony Vaio sülearvuti
+Name[eu]=Sony Vaio Magalekoa
+Name[fa]=Sony Vaio رایانۀ کیفی
+Name[fi]=Sony Vaio -liitännäinen
+Name[fr]=Portable Vaio de Sony
+Name[ga]=Ríomhaire Glúine Sony Vaio
+Name[he]=מחשב ברכיים מסוג Sony Vaio
+Name[hu]=Sony Vaio noteszgép
+Name[is]=Sony Vaio kjöltutölva
+Name[it]=Portatile Sony Vaio
+Name[ja]=Sony Vaio ラップトップ
+Name[kk]=Sony Vaio ноутбугі
+Name[km]=កុំព្យូទ័រ​យួរដៃ Sony Vaio
+Name[mk]=Лаптоп Sony Vaio
+Name[nb]=Programtillegg for Sony Vaio
+Name[nds]=Sony Vaio-Klappreekner
+Name[ne]=सोनी भाइयो लयापटप
+Name[nn]=Sony Vaio-bærbar
+Name[pa]=Sony Vaio ਲੈਪਟਾਪ
+Name[pl]=Wtyczka Sony Vaio
+Name[pt]='Plugin' para o Sony Vaio
+Name[pt_BR]=Laptop Sony Vaio
+Name[ro]=Laptop Sony Vaio
+Name[ru]=Ноутбук Sony Vaio
+Name[sk]=Sony Vaio
+Name[sl]=Prenosnik Sony Vaio
+Name[sr]=Sony-јев Vaio лаптоп
+Name[sr@Latn]=Sony-jev Vaio laptop
+Name[sv]=Sony Vaio bärbar dator
+Name[ta]=சோனி வையோ மடிக் கணிப்பொறி
+Name[tr]=Sony Vaio Dizüstü
+Name[uk]=Лептоп Sony Vaio
+Name[uz]=Sony Vaio laptopi
+Name[uz@cyrillic]=Sony Vaio лаптопи
+Name[zh_CN]=索尼 Vaio 插件
+Name[zh_TW]=Sony Vaio 筆記型電腦
+Comment=Configure the KDE Interface to the Sony Programmable Interrupt Controller Driver
+Comment[ar]=إعداد واجهة كدى لجهاز لمشغل التحكّم بالمقاطعة القابل للبرمجة من سونى
+Comment[bg]=Настройване на Sony Programmable Interrupt Controller Driver
+Comment[bs]=Podesite KDE interfejs za Sony Programmable Interrupt Controler drajver
+Comment[ca]=Configura la interfície entre KDE i el controlador d'interrupcions programables Sony
+Comment[cs]=Nastavení KDE rozhraní ovladače programovatelného řadiče přerušení Sony
+Comment[cy]=Ffurfweddu'r Rhyngwyneb KDE i'r Gyrrydd Rheolydd Ymyriadau Rhaglenadwy Sony
+Comment[da]=Indstil KDE's grænseflade til Sony's programmerbare Interrupt Controller Driver
+Comment[de]=Einrichten der KDE-Schnittstelle zum "Sony Programmable Interrupt Controller" Treiber
+Comment[el]=Ρυθμίστε το περιβάλλον χρήσης του KDE για τον Sony Programmable Interrupt Controller Driver
+Comment[es]=Configurar la interfaz de KDE para el controlador programable de interrupciones de Sony
+Comment[et]=KDE liides Sony programmeeritava katkestuskontrolleri draiveri seadistamiseks
+Comment[eu]=Konfiguratu Sonyren Interrupzio Kontrolatzaile Programagarriaren Gidariarentzako KDE Interfazea
+Comment[fa]=پیکربندی واسط KDE در گردانندۀ کنترل‌کنندۀ قابل برنامه‌ریزی دارای وقفه
+Comment[fi]=Aseta KDE:n liityntää Sonyn ohjelmoitavalle keskeytysajurille
+Comment[fr]=Configuration de l'interface KDE pour le pilote du contrôleur d'interruption programmable de Sony
+Comment[ga]=Cumraigh comhéadan KDE do Tiománaí an Rialtóir Idirbhriste Inríomhchláraithe Sony
+Comment[hi]=केडीई इंटरफेस को सोनी प्रोग्रामेबल इंटरप्ट कन्ट्रोलर ड्राइवर के लिए कॉन्फ़िगर करता है
+Comment[hu]=A Sony Vaio noteszgépek speciális kezelőelemeinek beállítása
+Comment[is]=Stilla viðmót KDE á Sony Programmable Interrupt stýringuna
+Comment[it]=Configura l'interfaccia KDE al driver del controller programmabile interrupt Sony
+Comment[ja]=Sony Programmable Interrupt Controller Driver の KDE インターフェースを設定
+Comment[kk]=Sony бағдарламаулы үзілім контроллердің драйверінің KDE интерфейсін баптау
+Comment[km]=កំណត់​រចនា​សម្ព័ន្ធ​ចំណុច​ប្រទាក់ KDE ទៅ​កម្មវិធី​បញ្ជា Sony Programmable Interrupt Controller
+Comment[lt]=KDE sąsaja Sony Programmable Interrupt Controller Driver konfigūravimui
+Comment[ms]= Selaraskan Antaramuka KDE untuk Pemacu Pengawal Gangguan Boleh Aturcara Sony
+Comment[nb]=Sett opp KDE-grensesnitt til Sony Programmable Interrupt Controller Driver
+Comment[nds]=KDE-Koppelsteedinstellen för den programmeerboren Interrupt-Controller-Driever vun Sony
+Comment[ne]=सोनी कार्यक्रमयोग्य अवरोध नियन्त्रक ड्राइभरमा KDE इन्टरफेस कन्फिगर गर्नुहोस्
+Comment[nl]=Voor het instellen van KDE's communicatie met het stuurprogramma van de Sony Programmeerbare Interrupt Controller
+Comment[nn]=Set opp KDE-grensesnittet til Sony Programmable Interrupt Controller Driver
+Comment[pl]=Konfigurujacja sterownika programowalnego kontrolora przerwań Sony w KDE
+Comment[pt]=Configurar a Interface para o KDE do Controlador do Programmable Interrupt Controller da Sony
+Comment[pt_BR]=Configura a Interface do KDE para o Driver Controlador de Interrupção Programável da Sony
+Comment[ro]=Configurează interfaţa KDE către modulul Sony de control al întreruperilor
+Comment[ru]=Настройка интерфейса KDE для драйвера программируемого контроллера прерываний Sony
+Comment[sk]=Nastavenie rozhrania KDE k Sony Programmable Interrupt Controller Driver
+Comment[sl]=Nastavite vmesnik KDE za gonilnik Sony Programmable Interrupt Controller
+Comment[sr]=Подесите KDE-ов интерфејс за управљачки програм Sony-јевог програмабилног контролера прекида
+Comment[sr@Latn]=Podesite KDE-ov interfejs za upravljački program Sony-jevog programabilnog kontrolera prekida
+Comment[sv]=Anpassa KDE:s gränssnitt till Sonys drivrutin för programmerbar avbrottshantering
+Comment[ta]=சோனி நிரல் தடங்கல் கட்டுப்பாட்டு சாதனத்துக்கு கேடிஇ இடைமுகத்தை வடிவமை
+Comment[tg]=Танзимкунии Интерфейси KDE барои Гардонандаи Танзимкунандаи кандашавии барномавии Sony
+Comment[tr]=KDE arayüzünü Sony Programlanabilir Kesilme Kontrolör Sürücüsüne ayarla
+Comment[uk]=Налаштування інтерфейсу KDE до драйвера перепин Sony
+Comment[zh_CN]=配置 KDE 界面使用索尼可编程中断控制器驱动程序
+Comment[zh_TW]=設定 Sony 可編程中斷控制器驅動程式的 KDE 介面
+Keywords=Sony, Vaio, kvaio, brightness, mute, Jog Dial
+Keywords[ca]=Sony, Vaio, kvaio, brillantor, silenci, Jog Dial
+Keywords[cs]=Sony,Vaio,kvaio,jas,ztlumení,Jog Dial
+Keywords[cy]=Sony, Vaio, kvaio, gloywder, mud, Jog Dial
+Keywords[da]=Sony, Vaio, kvaio, lysstyrke, stum, Jog Dial
+Keywords[de]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, stumm, hell, dunkel
+Keywords[el]=Sony, Vaio, kvaio, φωτεινότητα, κλείσιμο ήχου, Jog Dial
+Keywords[es]=Sony, Vaio, kvaio, brillo, mute, Jog Dial
+Keywords[et]=Sony, Vaio, kvaio, heledus, tumm, Jog Dial
+Keywords[eu]=Sony, Vaio, kvaio, distira, mutu, Jog Dial
+Keywords[fa]=Sony،Vaio، kvaio، روشنایی، بدون صدا، Jog Dial
+Keywords[fi]=Sony, Vaio, kvaio, kirkkaus, vaimenna, Jog Dial
+Keywords[fr]=Sony, Vaio, kvaio, luminosité, sourdine, mute, Jog Dial
+Keywords[ga]=Sony, Vaio, kvaio, gile, gan fuaim, Jog Dial
+Keywords[hi]=सोनी,वायो,के-वायो,चमकीलापन,म्यूट,जॉग डायल
+Keywords[hu]=Sony,Vaio,kvaio,fényerő,elnémítás,tárcsagomb
+Keywords[it]=Sony,Vaio,kvaio,luminosità,muto,Jog Dial
+Keywords[ja]=Sony, Vaio, kvaio, 明るさ, ミュート, ジョグダイアル
+Keywords[mk]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, Сони, осветленост, пригушување
+Keywords[ms]= kecerahan,bisu,Sony, Vaio, kvaio, brightness, mute, Jog Dial
+Keywords[nb]=Sony, Vaio, kvaio, lysstyrke, lydsperre, Jog Dial
+Keywords[nds]=Sony, Vaio, kvaio, Helligkeit, stumm, Jog Dial
+Keywords[ne]=सोनी, भाइयो, केभाइयो, चम्किलोपना, चुप लाग्नु, जोग डायल
+Keywords[nl]=Sony,Vaio,kvaio,brightness,helderheid,mute,Jog Dial
+Keywords[nn]=Sony,vaio,kvaio,lysstyrke,lydsperre,hjul
+Keywords[pl]=Sony, Vaio, kvaio, jasność, Jog Dial,jog,jogdial
+Keywords[pt]=Sony, Vaio, kvaio, brilho, sem som, Jog Dial
+Keywords[pt_BR]=Sony, Vaio, kvaio,brilho, mudo, Jog Dial
+Keywords[ro]=Sony,Vaio,kvaio,strălucire,fără sunet,jog dial
+Keywords[ru]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, яркость, звук
+Keywords[sk]=Sony, Vaio, kvaio, jas, potichu, Jog Dial
+Keywords[sl]=Sony, Vaio, kvaio, svetlost, tiho, Jog Dial
+Keywords[sr]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, светлина
+Keywords[sr@Latn]=Sony, Vaio, kvaio, brightness, mute, Jog Dial, svetlina
+Keywords[sv]=Sony, Vaio, kvaio, ljusstyrka, tyst, rullhjul
+Keywords[ta]=சோனி, வையொ, வெளிச்சம்,சத்தமில்லாத,ஜோக் டயல்
+Keywords[tg]=Sony, Vaio, kvaio, равшанӣ, хомӯшӣ, Jog Dial
+Keywords[tr]=Sony, Vaio, kvaio, parlaklık, sessiz, gösterme itmesi
+Keywords[uk]=Sony, Vaio, kvaio, яскравість, вимкнення звуку
+Keywords[zh_CN]=Sony, Vaio, kvaio, brightness, mute, Jog Dial,索尼,亮度,静音
+
+Categories=Qt;KDE;X-KDE-settings-system;
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/main.cpp b/kmilo/kmilo_kvaio/kcmkvaio/main.cpp
new file mode 100644
index 0000000..ce27c94
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/main.cpp
@@ -0,0 +1,176 @@
+/*
+ * main.cpp
+ *
+ * Copyright (C) 2003 Mirko Boehm (mirko@kde.org)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qcheckbox.h>
+#include <qtimer.h>
+#include <qslider.h>
+
+#include <dcopclient.h>
+#include <kgenericfactory.h>
+#include <kaboutdata.h>
+#include <kdebug.h>
+#include <kconfig.h>
+#include <kled.h>
+#include <kprogress.h>
+
+#include "kcmkvaio_general.h"
+
+#include <dcopclient.h>
+
+#include "main.h"
+#include "main.moc"
+
+typedef KGenericFactory<KVaioModule, QWidget> KVaioModuleFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kvaio, KVaioModuleFactory("kcmkvaio"))
+
+#define CONFIG_FILE "kmilodrc"
+
+
+KVaioModule::KVaioModule(QWidget *parent, const char *name, const QStringList &)
+ : KCModule(KVaioModuleFactory::instance(), parent, name)
+{
+ KAboutData *about =
+ new KAboutData(I18N_NOOP("kcmkvaio"),
+ I18N_NOOP("KDE Control Module for Sony "
+ "Vaio Laptop Hardware"),
+ 0, 0, KAboutData::License_GPL,
+ "(c) 2003 Mirko Boehm");
+
+ about->addAuthor("Mirko Boehm",
+ I18N_NOOP("Original author"),
+ "mirko@kde.org");
+ setAboutData( about );
+
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ mKVaioGeneral = new KCMKVaioGeneral(this);
+ layout->addWidget( mKVaioGeneral );
+ layout->addStretch();
+
+ mDriver = new KVaioDriverInterface(this);
+ mDriverAvailable = mDriver->connectToDriver(false);
+ mTimer = new QTimer(this);
+ mTimer->start(231);
+
+ load();
+ if (! mDriverAvailable)
+ {
+ mKVaioGeneral->tlOff->show();
+ mKVaioGeneral->frameMain->setEnabled(false);
+ setButtons(buttons() & ~Default);
+ } else {
+ mKVaioGeneral->tlOff->hide();
+ // mKVaioGeneral->frameMain->setEnabled (true);
+ }
+
+ connect(mKVaioGeneral, SIGNAL(changed()),
+ SLOT(changed()));
+ connect(mTimer, SIGNAL(timeout()), SLOT(timeout()));
+ connect(mDriver, SIGNAL (vaioEvent(int)), SLOT (vaioEvent(int) ) );
+}
+
+void KVaioModule::save()
+{
+ if (! mDriverAvailable) return;
+ DCOPClient mClient;
+
+ kdDebug() << "KVaioModule: saving." << endl;
+ KConfig config(CONFIG_FILE);
+
+ config.setGroup("KVaio");
+
+ config.writeEntry("Report_Unknown_Events",
+ mKVaioGeneral->cbReportUnknownEvents->isChecked());
+ config.writeEntry("PeriodicallyReportPowerStatus",
+ mKVaioGeneral->mCbPowerMsgs->isChecked() );
+ config.writeEntry("PowerStatusOnBackButton",
+ mKVaioGeneral->mCbBackButtonMsg->isChecked() );
+ config.sync();
+
+ if(mClient.attach())
+ {
+ QByteArray data, replyData;
+ QCString replyType;
+
+ if (!mClient.call("kded", "kmilod", "reconfigure()",
+ data, replyType, replyData))
+ {
+ kdDebug() << "KVaio::showTextMsg: "
+ << "there was some error using DCOP." << endl;
+ }
+ } else {
+ kdDebug() << "KVaioModule: cannot attach to DCOP server, "
+ << "no automatic config update." << endl;
+ }
+}
+
+void KVaioModule::load()
+{
+ load( false );
+}
+
+void KVaioModule::load(bool useDefaults)
+{
+ kdDebug() << "KVaioModule: loading." << endl;
+ KConfig config(CONFIG_FILE);
+
+ config.setReadDefaults( useDefaults );
+
+ config.setGroup("KVaio");
+ mKVaioGeneral->cbReportUnknownEvents->setChecked
+ (config.readBoolEntry("Report_Unknown_Events", false));
+ mKVaioGeneral->mCbPowerMsgs->setChecked
+ (config.readBoolEntry("PeriodicallyReportPowerStatus", false) );
+ mKVaioGeneral->mCbBackButtonMsg->setChecked
+ (config.readBoolEntry("PowerStatusOnBackButton", true) );
+
+ emit changed( useDefaults );
+}
+
+void KVaioModule::defaults()
+{
+ load( true );
+}
+
+void KVaioModule::timeout()
+{
+ bool bat1Avail = false, bat2Avail = false, acConnected = false;
+ int bat1Remaining = 0, bat1Max = 0, bat2Remaining = 0, bat2Max = 0;
+
+ if(mDriver->getBatteryStatus(bat1Avail, bat1Remaining, bat1Max,
+ bat2Avail, bat2Remaining, bat2Max,
+ acConnected) )
+ {
+ }
+ int remaining = (int)(100.0*(bat1Remaining+bat2Remaining)
+ / (bat1Max+bat2Max));
+ mKVaioGeneral->mKPBattery->setValue(remaining);
+ mKVaioGeneral->kledBat1->setState(bat1Avail ? KLed::On : KLed::Off);
+ mKVaioGeneral->kledBat2->setState(bat2Avail ? KLed::On : KLed::Off);
+ mKVaioGeneral->kledAC->setState(acConnected ? KLed::On : KLed::Off);
+}
+
+void KVaioModule::vaioEvent (int e)
+{
+ kdDebug () << "KVaioModule::vaioEvent: event: " << e << endl;
+}
+
diff --git a/kmilo/kmilo_kvaio/kcmkvaio/main.h b/kmilo/kmilo_kvaio/kcmkvaio/main.h
new file mode 100644
index 0000000..c19b648
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kcmkvaio/main.h
@@ -0,0 +1,53 @@
+/*
+ * main.h
+ *
+ * Copyright (C) 2003 Mirko Boehm (mirko@kde.org)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef KCMKVAIO_MAIN_H
+#define KCMKVAIO_MAIN_H
+
+#include <kcmodule.h>
+#include "../kvaiodriverinterface.h"
+
+class QTimer;
+class KCMKVaioGeneral;
+
+class KVaioModule : public KCModule
+{
+ Q_OBJECT
+
+public:
+ KVaioModule(QWidget *parent, const char *name, const QStringList &);
+
+ void save();
+ void load();
+ void load(bool useDefaults);
+ void defaults();
+
+protected slots:
+ void timeout();
+ void vaioEvent (int);
+private:
+ KCMKVaioGeneral *mKVaioGeneral;
+ KVaioDriverInterface *mDriver;
+ QTimer *mTimer;
+ bool mDriverAvailable;
+};
+
+#endif // KCMKVAIO_MAIN_H
diff --git a/kmilo/kmilo_kvaio/kmilo_kvaio.cpp b/kmilo/kmilo_kvaio/kmilo_kvaio.cpp
new file mode 100644
index 0000000..6389759
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kmilo_kvaio.cpp
@@ -0,0 +1,68 @@
+/* -*- C++ -*-
+
+ This file implements the KVaio module for KMilo.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+
+ * Portions of this code are
+ * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
+ * (C) 2001-2002 Alcove <www.alcove.com>.
+ * Thanks to Stelian for the implementation of the sonypi driver.
+*/
+
+#include <kgenericfactory.h>
+
+#include "monitor.h"
+#include "kmilo_kvaio.h"
+#include "kvaio.h"
+#include "kmilointerface.h"
+
+KMiloKVaio::KMiloKVaio(QObject *parent, const char *name,
+ const QStringList& args)
+ : Monitor(parent, name, args),
+ m_kvaio(0)
+{
+ _poll = false;
+ m_displayType = (Monitor::DisplayType)None ;
+}
+
+
+KMiloKVaio::~KMiloKVaio() {
+}
+
+
+bool KMiloKVaio::init()
+{
+ m_kvaio = new KVaio(this);
+
+ return m_kvaio->driver()!=0;
+}
+
+
+KMilo::Monitor::DisplayType KMiloKVaio::poll() {
+// Monitor::DisplayType rc = (Monitor::DisplayType)None;
+// return rc;
+ return m_displayType;
+}
+
+
+int KMiloKVaio::progress() const {
+ return m_kvaio->progress();
+}
+
+void KMiloKVaio::reconfigure(KConfig* k)
+{
+ m_kvaio->loadConfiguration(k);
+}
+
+K_EXPORT_COMPONENT_FACTORY(kmilo_kvaio, KGenericFactory<KMiloKVaio>("kmilo_kvaio"))
+
diff --git a/kmilo/kmilo_kvaio/kmilo_kvaio.desktop b/kmilo/kmilo_kvaio/kmilo_kvaio.desktop
new file mode 100644
index 0000000..5539734
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kmilo_kvaio.desktop
@@ -0,0 +1,106 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KMilo Plugin
+X-KDE-ModuleType=Plugin
+Name=Sony Vaio Plugin
+Name[ar]=ملحق سونى فايوة
+Name[br]=Lugent an hezoug Sony Vaio
+Name[bs]=Sony Vaio dodatak
+Name[ca]=Connector Sony Vaio
+Name[cs]=Sony Vaio modul
+Name[cy]=Ategyn Sony Vaio
+Name[da]=Sony Vaio plugin
+Name[el]=Πρόσθετο Sony Vaio
+Name[es]=Extensión para Sony Vaio
+Name[et]=Sony Vaio plugin
+Name[eu]=Sony Vaio Plugina
+Name[fa]=وصلۀ Sony Vaio
+Name[fi]=Sony Vaio -liitännäinen
+Name[fr]=Module externe pour les Vaio de Sony
+Name[ga]=Breiseán Sony Vaio
+Name[he]=תוסף ל-Sony Vaio
+Name[hi]=सोनी वायो प्लगइन
+Name[hu]=Sony Vaio bővítőmodul
+Name[is]=Sony Vaio íforrit
+Name[it]=Plugin per Sony Vaio
+Name[ja]=Sony Vaio プラグイン
+Name[ka]=Sony Vaio მოდული
+Name[kk]=Sony Vaio модулі
+Name[km]=កម្មវិធី​ជំនួយ Sony Vaio
+Name[lt]=Sony Vaio priedas
+Name[mk]=Приклучок за Sony Vaio
+Name[nb]=Programtillegg for Sony Vaio
+Name[nds]=Sony Vaio-Moduul
+Name[ne]=सोनी भाइयो प्लगइन
+Name[nl]=Sony Vaio-plugin
+Name[nn]=Tilleggsprogram for Sony Vaio
+Name[pa]=Sony Vaio ਪਲੱਗਿੰਨ
+Name[pl]=Wtyczka Sony Vaio
+Name[pt]='Plugin' para o Sony Vaio
+Name[pt_BR]=Plugin do Sony Vaio
+Name[ro]=Modul Sony Vaio
+Name[ru]=Модуль Sony Vaio
+Name[sk]=Modul pre Sony Vaio
+Name[sl]=Vstavek za Sony Vaio
+Name[sr]=Прикључак за Sony-јев Vaio
+Name[sr@Latn]=Priključak za Sony-jev Vaio
+Name[sv]=Sony Vaio-insticksprogram
+Name[ta]=சோனி வையோ சொருகு சாதனம்
+Name[tg]=Модули Sony Vaio
+Name[tr]=Sony Vaio Eklentisi
+Name[uk]=Втулок Sony Vaio
+Name[uz]=Sony Vaio plagini
+Name[uz@cyrillic]=Sony Vaio плагини
+Name[wa]=Tchôke-divins Sony Vaio
+Name[zh_CN]=索尼 Vaio 插件
+Name[zh_TW]=Sony Vaio 外掛程式
+Comment=KMilo Module for Sony Vaio Laptop support
+Comment[ar]=وحدة KMilo لدعم حاسوب سونى فايو المحمول
+Comment[bg]=Модул за поддръжка на KMilo за лаптопи Sony Vaio
+Comment[bs]=KMilo modul za podršku za Sony Vaio laptope
+Comment[ca]=Mòdul KMilo per funcionar amb portàtils Sony Vaio
+Comment[cs]=KMilo modul pro podporu notebooků Sony Vaio
+Comment[cy]=Cynhaliaeth Modiwl KMilo ar gyfer Gluniadur Sony Vaio
+Comment[da]=KMilo Modul for understøttelse af Sony Vaio bærbare
+Comment[de]=KMilo-Modul für Sony Vaio Notebook-Unterstützung
+Comment[el]=Πρόσθετο KMilo για υποστήριξη του φορητού Sony Vaio
+Comment[es]=Módulo KMilo para el soporte del portátil Sony Vaio
+Comment[et]=KMilo moodul Sony Vaio sülearvuti toega
+Comment[eu]=KMilo Moduloa Sony Vaio Magalekoen euskarriarentzako
+Comment[fa]=پیمانۀ KMilo برای پشتیبانی رایانۀ کیفی Sony Vaio
+Comment[fi]=KMilo-moduuli Sony Vaio -kannettavatuelle
+Comment[fr]=Module KMilo pour la gestion des portables Vaio de Sony
+Comment[ga]=Modúl KMilo a thacaíonn le Sony Vaio
+Comment[he]=KMilo מודול לתמיכה במחשב הברכיים Vaio של Sony
+Comment[hi]=सोनी वायो लेपटॉप समर्थन के लिए के-मिलो मॉड्यूल
+Comment[hu]=KMilo beállítómodul Sony Vaio noteszgépek beállításához
+Comment[is]=KMilo eining fyrir Sony Vaio kjöltutölvur
+Comment[it]=Modulo di KMilo per il supporto dei portatili Sony Vaio
+Comment[ja]=Sony Vaio ラップトップをサポートする KMilo モジュール
+Comment[ka]=Sony Vaio ლეპტოპის მხარდამჭერი KMilo მოდული
+Comment[kk]=Sony Vaio ноутбукті қолдау KMilo модулі
+Comment[km]=ម៉ូឌុល KMilo សម្រាប់​ការគាំទ្រ​កុំព្យូទ័រ​យួរដៃ Sony Vaio
+Comment[lt]=KMilo modulis Sony Vaio Laptop palaikymui
+Comment[mk]=Модул од KMilo за поддршка за лаптопот Sony Vaio
+Comment[nb]=KMilo modul for Sony Vaio bærbar maskin
+Comment[nds]=KMilo-Moduul för Sony-Vaio-Klappreeknerünnerstütten
+Comment[ne]=सोनी भाइयो ल्यापटप समर्थनका लागि केमिलो मोड्युल
+Comment[nl]=KMilo-module met ondersteuning voor de Sony Vaio laptop
+Comment[nn]=KMilo-modul for Sony Vaio bærbar maskin
+Comment[pl]=Moduł KMilo do obsługi laptopów Sony Vaio
+Comment[pt]=Módulo do KMilo para o suporte do portátil Vaio da Sony
+Comment[pt_BR]= Módulo para o suporte ao Sony Vaio
+Comment[ro]=Modul KMilo pentru suport laptop Sony Vaio
+Comment[ru]=Модуль KMilo для ноутбуков Sony Vaio
+Comment[sk]=Module pre podporu Sony Vaio pre KMilo
+Comment[sl]=Modul KMilo za podporo prenosniku Sony Vaio
+Comment[sr]=KMilo, модул за подршку Sony-јевог Vaio лаптопа
+Comment[sr@Latn]=KMilo, modul za podršku Sony-jevog Vaio laptopa
+Comment[sv]=Kmilo-modul för stöd av bärbar Sony Vaio-dator
+Comment[ta]=சோனி வையோ மடிக் கணினி ஆதரவுக்கான கேமிலோ கூறு
+Comment[tg]=Модули KMilo барои пуштибонии Компютери дастии Sony Vaio
+Comment[tr]=Sony Vaio Dizüstüler için KMilo Modül desteği
+Comment[uk]=Модуль KMilo, що додає підтримку лептопів Sony Vaio
+Comment[zh_CN]=索尼 Vaio 便携电脑支持的 KMilo 模块
+Comment[zh_TW]=支援 Sony Vaio 筆記型電腦的 KMilo 模組
+X-KDE-Library=kmilo_kvaio
diff --git a/kmilo/kmilo_kvaio/kmilo_kvaio.h b/kmilo/kmilo_kvaio/kmilo_kvaio.h
new file mode 100644
index 0000000..fccd7e9
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kmilo_kvaio.h
@@ -0,0 +1,66 @@
+/* -*- C++ -*-
+
+ This file declares the KVaio module for KMilo.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+
+ * Portions of this code are
+ * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
+ * (C) 2001-2002 Alcove <www.alcove.com>.
+ * Thanks to Stelian for the implementation of the sonypi driver.
+*/
+
+#ifndef _KMILO_KVAIO_H_
+#define _KMILO_KVAIO_H_
+
+#include <kmainwindow.h>
+#include <kglobalaccel.h>
+#include <dcopref.h>
+#include <kapplication.h>
+
+#include "kmilod.h"
+#include "monitor.h"
+#include "kmilointerface.h"
+
+class KVaio;
+
+class KMiloKVaio : public KMilo::Monitor {
+// Q_OBJECT
+
+ public:
+ KMiloKVaio(QObject *parent,
+ const char *name, const QStringList&);
+ virtual ~KMiloKVaio();
+
+ virtual bool init();
+ virtual DisplayType poll();
+ virtual int progress() const;
+
+ virtual void reconfigure(KConfig*);
+
+
+ bool showTextMsg(const QString& msg) {
+ _interface->displayText(msg);
+ return true;
+ }
+ bool showProgressMsg(const QString& msg, int progress) {
+ _interface->displayProgress(msg,progress);
+ return true;
+ }
+
+ private:
+ KVaio *m_kvaio;
+ Monitor::DisplayType m_displayType;
+};
+
+
+#endif
diff --git a/kmilo/kmilo_kvaio/kvaio.cpp b/kmilo/kmilo_kvaio/kvaio.cpp
new file mode 100644
index 0000000..8a02098
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kvaio.cpp
@@ -0,0 +1,606 @@
+/* -*- C++ -*-
+
+ This file implements the KVaio class.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+
+ * Portions of this code are
+ * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
+ * (C) 2001-2002 Alcove <www.alcove.com>.
+ * Thanks to Stelian for the implementation of the sonypi driver.
+
+ * Modified by Toan Nguyen <nguyenthetoan@gmail.com>
+ * to include support for
+ * Fn+F2,F3,F4 (Volume)
+ * Fn+F5,F6 (Brightness)
+ * Fn+F1 (blankscreen)
+ * Fn+F12 (suspend to disk)
+*/
+
+#include <kconfig.h>
+
+#include "kvaio.h"
+#include "kmilointerface.h"
+
+#include <qlabel.h>
+#include <qcstring.h>
+#include <qevent.h>
+#include <qdatastream.h>
+#include <kmainwindow.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kdialogbase.h>
+#include <dcopclient.h>
+#include <kapplication.h>
+
+extern "C" {
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <getopt.h>
+#include <errno.h>
+
+#include "./sonypi.h"
+}
+
+
+KVaio::KVaio(KMiloKVaio *parent, const char* name)
+ : QObject(parent, name),
+ mDisp(0),
+ mTimer (new QTimer (this) )
+{
+ myparent = parent;
+
+ mDriver = new KVaioDriverInterface(this);
+
+ if(!mDriver->connectToDriver())
+ {
+ delete mDriver; mDriver = 0L;
+ kdDebug() << "KVaio: Cannot connect to driver." << endl;
+ } else {
+ kdDebug() << "KVaio: Connected to SonyPI driver." << endl;
+ connect(mDriver, SIGNAL(vaioEvent(int)), SLOT(slotVaioEvent(int)));
+ connect (mTimer, SIGNAL (timeout ()), SLOT (slotTimeout() ) );
+ mTimer->start (10000, true);
+ }
+
+ mDisp = XOpenDisplay(NULL);
+ if(!mDisp)
+ {
+ kdDebug() << "KVaio ctor: Failed to open display. Very strange."
+ << endl;
+ }
+
+ if(!mClient.attach())
+ {
+ kdDebug() << "KVaio ctor: cannot attach to DCOP server." << endl;
+ }
+
+ KConfig config("kmilodrc");
+
+ loadConfiguration(&config);
+
+ m_mute = false;
+ m_progress = 0;
+ m_minVolume = 0;
+ m_maxVolume = 100;
+ m_volume = 50;
+
+ m_VolumeStep = 10;
+
+ m_brightness = 128;
+ m_minBright = 0;
+ m_maxBright = 255;
+ m_BrightnessStep = 16;
+
+ kmixClient = new DCOPRef("kmix", "Mixer0");
+ kmixWindow = new DCOPRef("kmix", "kmix-mainwindow#1");
+// retrieveVolume();
+// retrieveMute();
+
+}
+
+KVaio::~KVaio()
+{
+ kdDebug() << "KVaio dtor: shutting down." << endl;
+ if(mDriver!=0)
+ {
+ mDriver->disconnectFromDriver();
+ }
+ if(mClient.isAttached())
+ {
+ mClient.detach();
+ }
+}
+
+void KVaio::slotVaioEvent(int event)
+{
+ QString text;
+ QTextStream stream(text, IO_WriteOnly);
+
+ switch(event)
+ {
+ case SONYPI_EVENT_FNKEY_RELEASED:
+ break;
+ case SONYPI_EVENT_FNKEY_F1:
+ blankScreen();
+ break;
+ case SONYPI_EVENT_FNKEY_F2:
+ mute();
+ break;
+ case SONYPI_EVENT_FNKEY_F3:
+ VolumeDown(m_VolumeStep);
+ break;
+ case SONYPI_EVENT_FNKEY_F4:
+ VolumeUp(m_VolumeStep);
+ break;
+ case SONYPI_EVENT_FNKEY_F5:
+ BrightnessDown(m_BrightnessStep);
+ break;
+ case SONYPI_EVENT_FNKEY_F6:
+ BrightnessUp(m_BrightnessStep);
+ break;
+ case SONYPI_EVENT_FNKEY_F12:
+ suspendToDisk();
+ break;
+ case SONYPI_EVENT_MEMORYSTICK_INSERT:
+ showTextMsg( i18n ("Memory Stick inserted") );
+ break;
+ case SONYPI_EVENT_MEMORYSTICK_EJECT:
+ showTextMsg( i18n ("Memory Stick ejected") );
+ break;
+ case SONYPI_EVENT_BACK_PRESSED:
+ if (mShowPowerStatusOnBackButton)
+ {
+ showBatteryStatus (true);
+ }
+ break;
+ default:
+ stream << i18n("Unhandled event: ") << event;
+ if(mReportUnknownEvents) showTextMsg(text);
+ kdDebug() << "KVaio::slotVaioEvent: event not handled."
+ << endl;
+ }
+}
+
+bool KVaio::showTextMsg(const QString& msg)
+{
+ return myparent->showTextMsg(msg);
+}
+
+
+
+bool KVaio::showProgressMsg(const QString& msg, int value)
+{
+ m_progress = value;
+ return myparent->showProgressMsg(msg,value);
+}
+
+void KVaio::blankScreen()
+{
+ bool blankonly;
+
+ if (isKScreensaverAvailable()) {
+
+ QByteArray data, replyData;
+ QDataStream arg(data, IO_WriteOnly);
+ QCString replyType;
+
+ /* Set the screensave to BlankOnly mode */
+ blankonly = true;
+ arg << blankonly;
+ mClient.call("kdesktop","KScreensaverIface","setBlankOnly(bool)",
+ data, replyType, replyData) ;
+
+ /* Save the screen */
+ if ( !mClient.call("kdesktop", "KScreensaverIface", "save()",
+ data, replyType, replyData) )
+ {
+ kdDebug() << "KVaio::blankScreen: there was some error "
+ << "using DCOP." << endl;
+ }
+
+ /* Set the screensave to its original mode */
+ blankonly = false;
+ arg << blankonly;
+ mClient.call("kdesktop","KScreensaverIface","setBlankOnly(bool)",
+ data, replyType, replyData) ;
+
+ }
+
+}
+
+void KVaio::suspendToDisk()
+{
+ QByteArray data, replyData;
+ QDataStream arg(data, IO_WriteOnly);
+ QCString replyType;
+
+ mClient.call("kpowersave","KPowersaveIface","do_suspendToDisk()",
+ data, replyType, replyData) ;
+}
+
+
+bool KVaio::isKScreensaverAvailable()
+{
+ if(mClient.isAttached())
+ {
+ // kdDebug() << "KVaio::showTextMsg: attached to DCOP server." << endl;
+ if(mClient.isApplicationRegistered("kdesktop"))
+ {
+ QCStringList objects;
+
+ // kdDebug() << "KVaio::showTextMsg: kded is registered at dcop server."
+ // << endl;
+ objects = mClient.remoteObjects("kdesktop");
+ if(objects.contains("KScreensaverIface"))
+ {
+ // kdDebug() << "KVaio::showTextMsg: kmilod is available at kded."
+ // << endl;
+ return true;
+ } else {
+ kdDebug() << "KVaio::isKScreensaverAvailable: "
+ << "KScreensaverIface is NOT available at kdesktop." << endl;
+ return false;
+ }
+ } else {
+ kdDebug() << "KVaio::isKScreensaverAvailable: "
+ << "kdesktop is NOT registered at dcop server." << endl;
+ return false;
+ }
+ } else {
+ kdDebug() << "KVaio::isKScreensaverAvailable: "
+ << "kdesktop is NOT registered at dcop server." << endl;
+ return false;
+ }
+}
+
+bool KVaio::isKMiloDAvailable()
+{
+ if(mClient.isAttached())
+ {
+ // kdDebug() << "KVaio::showTextMsg: attached to DCOP server." << endl;
+ if(mClient.isApplicationRegistered("kded"))
+ {
+ QCStringList objects;
+
+ // kdDebug() << "KVaio::showTextMsg: kded is registered at dcop server."
+ // << endl;
+ objects = mClient.remoteObjects("kded");
+ if(objects.contains("kmilod"))
+ {
+ // kdDebug() << "KVaio::showTextMsg: kmilod is available at kded."
+ // << endl;
+ return true;
+ } else {
+ kdDebug() << "KVaio::isKMiloDAvailable: "
+ << "kmilod is NOT available at kded." << endl;
+ return false;
+ }
+ } else {
+ kdDebug() << "KVaio::isKMiloDAvailable: "
+ << "kded is NOT registered at dcop server." << endl;
+ return false;
+ }
+ } else {
+ kdDebug() << "KVaio::isKMiloDAvailable: "
+ << "kded is NOT registered at dcop server." << endl;
+ return false;
+ }
+}
+
+void KVaio::loadConfiguration(KConfig *k)
+{
+ k->setGroup("KVaio");
+
+ mReportUnknownEvents =
+ k->readBoolEntry("Report_Unknown_Events", false);
+ mReportPowerStatus =
+ k->readBoolEntry("PeriodicallyReportPowerStatus", false);
+ mShowPowerStatusOnBackButton =
+ k->readBoolEntry("PowerStatusOnBackButton", true);
+
+ kdDebug() << "KVaio::loadConfiguration: " << endl
+ << " mReportUnknownEvents: "
+ << mReportUnknownEvents << endl
+ << " mReportPowerStatus: "
+ << mReportPowerStatus << endl
+ << "mShowPowerStatusOnBackButton: "
+ << mShowPowerStatusOnBackButton << endl;
+}
+
+const KVaioDriverInterface* KVaio::driver()
+{
+ return mDriver;
+}
+
+void KVaio::slotTimeout ()
+{
+ showBatteryStatus ();
+ mTimer->start (4000, true);
+}
+
+bool KVaio::showBatteryStatus ( bool force )
+{
+ static bool acConnectedCache = false;
+ static int previousChargeCache = -1;
+ bool bat1Avail = false, bat2Avail = false, acConnected = false;
+ int bat1Remaining = 0, bat1Max = 0, bat2Remaining = 0, bat2Max = 0;
+ bool displayBatteryMsg = false;
+ bool displayACStatus = false;
+
+ QString text, acMsg;
+ QTextStream stream(text, IO_WriteOnly);
+
+ // -----
+ // only display on startup if mReportPowerStatus is true:
+ if (mReportPowerStatus==false || !force)
+ {
+ return true;
+ }
+
+ // query all necessary information:
+ (void) mDriver->getBatteryStatus(bat1Avail, bat1Remaining, bat1Max,
+ bat2Avail, bat2Remaining, bat2Max,
+ acConnected);
+
+ int remaining;
+ if ( bat1Avail || bat2Avail )
+ remaining = (int)(100.0*(bat1Remaining+bat2Remaining)
+ / (bat1Max+bat2Max));
+ else
+ remaining = -1; // no battery available
+
+ if (acConnectedCache != acConnected || force)
+ {
+ displayACStatus = true;
+ acConnectedCache = acConnected;
+ }
+
+ displayBatteryMsg = ( previousChargeCache * 100 / remaining > 1000 )
+ || ( previousChargeCache * 100 / remaining > 200 && remaining < 10 )
+ || force;
+
+
+ if (displayBatteryMsg)
+ {
+ previousChargeCache = remaining;
+ }
+
+ // ----- prepare text messages
+ if (displayACStatus || displayBatteryMsg)
+ {
+
+ if (displayACStatus)
+ {
+ acMsg = acConnected ? i18n ("AC Connected") : i18n ("AC Disconnected");
+ }
+
+ switch (remaining)
+ {
+ case 100:
+ stream << i18n("Battery is Fully Charged. ");
+ break;
+ case 5:
+ case 4:
+ case 3:
+ case 2:
+ case 1:
+ stream << i18n("Caution: Battery is Almost Empty (%1% remaining).").arg(remaining);
+ break;
+ case 0:
+ stream << i18n("Alert: Battery is Empty!");
+ break;
+ case -1:
+ stream << i18n("No Battery Inserted.");
+ break;
+ default:
+ stream << i18n("Remaining Battery Capacity: %1%").arg( remaining );
+ };
+
+ // show a message if the battery status changed by more then 10% or on startup
+ if (displayACStatus)
+ {
+ stream << endl << acMsg;
+ }
+
+ return showTextMsg (text);
+ } else {
+ return true;
+ }
+}
+
+void KVaio::BrightnessUp(int step)
+{
+ m_brightness = mDriver->brightness();
+
+ m_brightness += step;
+ if(m_brightness > m_maxBright) {
+ m_brightness = m_maxBright;
+ }
+
+ mDriver->setBrightness(m_brightness);
+ showProgressMsg( i18n("Brightness"), m_brightness*100/255);
+}
+
+void KVaio::BrightnessDown(int step)
+{
+ m_brightness = mDriver->brightness();
+
+ m_brightness -= step;
+ if(m_brightness < m_minBright) {
+ m_brightness = m_minBright;
+ }
+
+ mDriver->setBrightness(m_brightness);
+ showProgressMsg( i18n("Brightness"), m_brightness*100/255);
+}
+
+
+void KVaio::displayVolume()
+{
+// _interface->displayProgress(i18n("Volume"), m_volume);
+
+ showProgressMsg(i18n("Volume"), m_volume);
+ // If we got this far, the DCOP communication with kmix works,
+ // so we don't have to test the result.
+ kmixClient->send("setMasterVolume", m_volume);
+
+ // if mute then unmute
+ if (m_mute)
+ {
+ m_mute = false;
+ kmixClient->send("setMasterMute", m_mute);
+ }
+}
+
+
+bool KVaio::retrieveVolume() {
+ bool kmix_error = false;
+
+ DCOPReply reply = kmixClient->call("masterVolume");
+ if (reply.isValid())
+ m_volume = reply;
+ else
+ kmix_error = true;
+
+ if (kmix_error) // maybe the error occurred because kmix wasn't running
+ {
+// _interface->displayText
+ showTextMsg(i18n("Starting KMix..."));
+ if (kapp->startServiceByDesktopName("kmix")==0) // trying to start kmix
+ {
+ // trying again
+ reply = kmixClient->call("masterVolume");
+ if (reply.isValid())
+ {
+ m_volume = reply;
+ kmix_error = false;
+ kmixWindow->send("hide");
+ }
+ }
+ }
+
+ if (kmix_error)
+ {
+ kdDebug() << "KMilo: GenericMonitor could not access kmix/Mixer0 via dcop"
+ << endl;
+ //_interface->displayText
+ showTextMsg(i18n("It seems that KMix is not running."));
+
+ return false;
+ } else {
+ return true;
+ }
+}
+
+void KVaio::VolumeUp(int step)
+{
+ if (!retrieveVolume())
+ return;
+
+ // FIXME if the mixer doesn't support steps of the specified size it
+ // could get stuck at one position
+ m_volume += step;
+ if (m_volume > m_maxVolume)
+ m_volume = m_maxVolume;
+
+ displayVolume();
+}
+
+void KVaio::VolumeDown(int step)
+{
+ if (!retrieveVolume())
+ return;
+
+ m_volume -= step;
+ if (m_volume < m_minVolume)
+ m_volume = m_minVolume;
+
+ displayVolume();
+}
+
+bool KVaio::retrieveMute()
+{
+ bool kmix_error = false;
+
+ DCOPReply reply = kmixClient->call("masterMute");
+ if (reply.isValid())
+ m_volume = reply;
+ else
+ kmix_error = true;
+
+ if (kmix_error)
+ {
+ // maybe the error occurred because kmix wasn't running
+ //_interface->displayText
+ showTextMsg(i18n("Starting KMix..."));
+ if (kapp->startServiceByDesktopName("kmix")==0) // trying to start kmix
+ {
+ // trying again
+ reply = kmixClient->call("masterMute");
+ if (reply.isValid())
+ {
+ m_mute = reply;
+ kmix_error = false;
+ kmixWindow->send("hide");
+ }
+ } else
+ {
+ kmixWindow->send("hide");
+ kmix_error = true;
+ }
+ }
+
+ if (kmix_error)
+ {
+ kdDebug() << "KMilo: GenericMonitor could not access kmix/Mixer0 via dcop"
+ << endl;
+ //_interface->displayText
+ showTextMsg(i18n("It seems that KMix is not running."));
+
+ return false;
+ } else {
+ return true;
+ }
+}
+
+void KVaio::mute()
+{
+ if (!retrieveMute())
+ return;
+
+ m_mute = !m_mute;
+
+ int newVolume;
+ QString muteText;
+ if (m_mute)
+ {
+ m_oldVolume = m_volume;
+ newVolume = 0;
+ muteText = i18n("Mute on");
+ } else {
+ newVolume = m_oldVolume;
+ muteText = i18n("Mute off");
+ }
+
+ kmixClient->send("setMasterMute", m_mute);
+
+ //_interface->displayText(muteText);
+ showTextMsg(muteText);
+
+}
+
+
+#include "kvaio.moc"
diff --git a/kmilo/kmilo_kvaio/kvaio.h b/kmilo/kmilo_kvaio/kvaio.h
new file mode 100644
index 0000000..c16f27e
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kvaio.h
@@ -0,0 +1,113 @@
+/* -*- C++ -*-
+
+ This file declares the KVaio class.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+
+ * Portions of this code are
+ * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
+ * (C) 2001-2002 Alcove <www.alcove.com>.
+ * Thanks to Stelian for the implementation of the sonypi driver.
+*/
+
+#ifndef _KVAIO_H
+#define _KVAIO_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qtimer.h>
+
+#include <dcopclient.h>
+#include <dcopref.h>
+#include <kmainwindow.h>
+#include "kvaiodriverinterface.h"
+#include "monitor.h"
+#include "kmilo_kvaio.h"
+
+extern "C" {
+#include <X11/Xlib.h>
+//#include <X11/extensions/XTest.h>
+}
+
+class KVaio;
+class KMiloKVaio;
+
+/**
+ * @short KVaio class
+ * This class provides an interface between the Vaio driver and the
+ * respective application (either the kmilod module or a single
+ * application).
+ * This class provides the application of the events created by the
+ * KVaioDriverInterface class.
+ * @author Mirko Boehm <mirko@hackerbuero.org>
+ * @version 0.2
+ */
+class KVaio : public QObject
+{
+ Q_OBJECT
+public:
+// KVaio(QObject *parent = 0, const char *name =0);
+ KVaio(KMiloKVaio *parent = 0, const char *name =0);
+
+ virtual ~KVaio();
+ const KVaioDriverInterface *driver();
+ void loadConfiguration(KConfig *);
+ const int progress() { return m_progress; }
+
+protected:
+ KVaioDriverInterface *mDriver;
+ Display *mDisp;
+ DCOPClient mClient;
+ bool isKScreensaverAvailable();
+ bool isKMiloDAvailable();
+ bool showTextMsg(const QString& msg);
+ bool showProgressMsg(const QString& msg, int progress);
+ bool showBatteryStatus ( bool force = false);
+protected slots:
+ void slotVaioEvent(int);
+ void slotTimeout();
+public slots:
+ void blankScreen();
+ void suspendToDisk();
+ void BrightnessUp(int step);
+ void BrightnessDown(int step);
+ void VolumeUp(int step);
+ void VolumeDown(int step);
+ void mute();
+private:
+ bool retrieveMute();
+ bool retrieveVolume();
+ void displayVolume();
+
+ KMiloKVaio *myparent;
+
+ DCOPRef *kmixClient, *kmixWindow;
+
+ int m_progress;
+ int m_volume, m_oldVolume, m_brightness;
+ bool m_mute;
+
+ int m_maxVolume, m_minVolume;
+ int m_maxBright, m_minBright;
+
+ int m_VolumeStep;
+ int m_BrightnessStep;
+
+ bool mReportUnknownEvents;
+ bool mReportPowerStatus;
+ bool mShowPowerStatusOnBackButton;
+ QTimer *mTimer;
+};
+
+#endif // _KVAIO_H
diff --git a/kmilo/kmilo_kvaio/kvaiodriverinterface.cpp b/kmilo/kmilo_kvaio/kvaiodriverinterface.cpp
new file mode 100644
index 0000000..32da70a
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kvaiodriverinterface.cpp
@@ -0,0 +1,221 @@
+/* -*- C++ -*-
+
+ This file implements the KVaioDriverInterface class.
+ It provides an event-oriented wrapper for the kernel sonypi driver.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+
+ * Portions of this code are
+ * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
+ * (C) 2001-2002 Alcove <www.alcove.com>.
+ * Thanks to Stelian for the implementation of the sonypi driver.
+*/
+
+#include "kvaiodriverinterface.h"
+
+extern "C" {
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <linux/types.h>
+#include <X11/Xlib.h>
+//#include <X11/extensions/XTest.h>
+
+#include "./sonypi.h"
+}
+
+#include <qsocketnotifier.h>
+#include <kdebug.h>
+
+// Taken from Stelian Pop's spicctrl utility:
+
+/* Have our own definition of ioctls... */
+
+/* get/set brightness */
+#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
+#define SONYPI_IOCSBRT _IOW('v', 0, __u8)
+
+/* get battery full capacity/remaining capacity */
+#define SONYPI_IOCGBAT1CAP _IOR('v', 2, __u16)
+#define SONYPI_IOCGBAT1REM _IOR('v', 3, __u16)
+#define SONYPI_IOCGBAT2CAP _IOR('v', 4, __u16)
+#define SONYPI_IOCGBAT2REM _IOR('v', 5, __u16)
+
+/* get battery flags: battery1/battery2/ac adapter present */
+#define SONYPI_BFLAGS_B1 0x01
+#define SONYPI_BFLAGS_B2 0x02
+#define SONYPI_BFLAGS_AC 0x04
+#define SONYPI_IOCGBATFLAGS _IOR('v', 7, __u8)
+
+/* get/set bluetooth subsystem state on/off */
+#define SONYPI_IOCGBLUE _IOR('v', 8, __u8)
+#define SONYPI_IOCSBLUE _IOW('v', 9, __u8)
+
+KVaioDriverInterface::KVaioDriverInterface(QObject *parent)
+ : QObject(parent),
+ mFd(0),
+ mNotifier(0)
+{
+}
+
+bool KVaioDriverInterface::connectToDriver(bool listen)
+{
+ const char* DriverFile = "/dev/sonypi";
+
+ mFd = open(DriverFile, O_RDONLY);
+
+ // mFd = open(DriverFile, O_RDWR);
+
+ if(mFd == -1)
+ {
+ kdDebug() << "KVaio: Failed to open /dev/sonypi: "
+ << strerror(errno) << "." << endl;
+ return false;
+ }
+
+ fcntl(mFd, F_SETFL, fcntl(mFd, F_GETFL) | O_ASYNC);
+
+ if(listen)
+ {
+ mNotifier = new QSocketNotifier(mFd, QSocketNotifier::Read, this);
+ connect(mNotifier, SIGNAL(activated(int)), SLOT(socketActivated(int)));
+ }
+ return true;
+}
+
+void KVaioDriverInterface::disconnectFromDriver()
+{
+ delete mNotifier;
+ mNotifier = 0;
+
+ if(mFd!=0)
+ {
+ close(mFd);
+ mFd = 0;
+ }
+}
+
+void KVaioDriverInterface::socketActivated(int)
+{
+ unsigned char events[8];
+ int count;
+
+ do {
+ count = read(mFd, &events, sizeof(events));
+ for(int index = 0; index<count; index++)
+ {
+ emit(vaioEvent(events[index]));
+ }
+ } while(count==sizeof(events));
+}
+
+int KVaioDriverInterface::brightness()
+{
+ unsigned char value = 0;
+ int result=0;
+
+ result = ioctl(mFd, SONYPI_IOCGBRT, &value);
+
+ if (result >= 0)
+ {
+ return value;
+ } else {
+ return -1;
+ }
+
+}
+
+void KVaioDriverInterface::setBrightness(int value)
+{
+ static unsigned char cache; // to avoid unnecessary updates
+ int result;
+ unsigned char value8 = 0;
+
+ if(value<0) value=0;
+ if(value>255) value=255;
+
+ value8 = __u8(value);
+
+ if(value8 != cache)
+ {
+ result = ioctl(mFd, SONYPI_IOCSBRT, &value8);
+
+ if(result<0)
+ {
+ kdDebug() << "KVaioDriverInterface::setBrightness: ioctl failed."
+ << endl;
+ }
+ cache = value8;
+ }
+}
+
+bool KVaioDriverInterface::getBatteryStatus(
+ bool& bat1Avail, int& bat1Remaining, int& bat1Max,
+ bool& bat2Avail, int& bat2Remaining, int& bat2Max,
+ bool& acConnected)
+{
+ unsigned char batFlags = 0;
+
+ bool retval = true;
+
+ if(ioctl(mFd, SONYPI_IOCGBATFLAGS, &batFlags)<0)
+ {
+ retval = false;
+ } else {
+ __u16 rem1 = 0, rem2 = 0, cap1 = 0, cap2 = 0;
+
+ bat1Avail = batFlags & SONYPI_BFLAGS_B1;
+ bat2Avail = batFlags & SONYPI_BFLAGS_B2;
+ acConnected = batFlags & SONYPI_BFLAGS_AC;
+
+// kdDebug() << "KVaioDriverInterface::getBatteryStatus: battery 1: "
+// << (bat1Avail ? "available" : "not available") << endl
+// << " battery 2: "
+// << (bat2Avail ? "available" : "not available") << endl
+// << " AC adapter: "
+// << (acConnected ? "connected" : "connected")
+// << "." << endl;
+
+ if(bat1Avail
+ && ioctl(mFd, SONYPI_IOCGBAT1CAP, &cap1) >= 0
+ && ioctl(mFd, SONYPI_IOCGBAT1REM, &rem1) >= 0)
+ {
+ bat1Max = cap1;
+ bat1Remaining = rem1;
+ } else {
+ bat1Remaining = 0;
+ bat1Max = 0;
+ retval = false;
+ }
+
+ if(bat2Avail
+ && ioctl(mFd, SONYPI_IOCGBAT2CAP, &cap2) >= 0
+ && ioctl(mFd, SONYPI_IOCGBAT2REM, &rem2) >= 0)
+ {
+ bat2Max = cap2;
+ bat2Remaining = rem2;
+ } else {
+ bat2Remaining = 0;
+ bat2Max = 0;
+ retval = false;
+ }
+ }
+
+ return retval;
+}
+
+#include "kvaiodriverinterface.moc"
+
diff --git a/kmilo/kmilo_kvaio/kvaiodriverinterface.h b/kmilo/kmilo_kvaio/kvaiodriverinterface.h
new file mode 100644
index 0000000..55c32b6
--- /dev/null
+++ b/kmilo/kmilo_kvaio/kvaiodriverinterface.h
@@ -0,0 +1,62 @@
+/* -*- C++ -*-
+
+ This file declares the KVaioDrierInterface class.
+ It provides an event-oriented wrapper for the kernel sonypi driver.
+
+ $ Author: Mirko Boehm $
+ $ Copyright: (C) 1996-2003, Mirko Boehm $
+ $ Contact: mirko@kde.org
+ http://www.kde.org
+ http://www.hackerbuero.org $
+ $ License: LGPL with the following explicit clarification:
+ This code may be linked against any version of the Qt toolkit
+ from Troll Tech, Norway. $
+
+ $Id$
+*/
+
+#ifndef KVAIO_DRIVERINTERFACE_H
+#define KVAIO_DRIVERINTERFACE_H
+
+#include <qobject.h>
+
+class QTimer;
+
+extern "C"
+{
+#include <fcntl.h>
+
+#include "./sonypi.h"
+}
+
+class QSocketNotifier;
+
+class KVaioDriverInterface : public QObject
+{
+ Q_OBJECT
+public:
+ KVaioDriverInterface(QObject *parent=0);
+ bool connectToDriver(bool listen = true);
+ void disconnectFromDriver();
+ /** Return the current display brightness, a value between 0 and
+ 255. Returns -1 if the setting cannot be retrieved. */
+ int brightness();
+ /** Get the battery status. */
+ bool getBatteryStatus(bool& bat1Avail, int& bat1Remaining, int& bat1Max,
+ bool& bat2Avail, int& bat2Remaining, int& bat2Max,
+ bool& acConnected);
+public slots:
+ /** Set the display brightness. 0<= value <=255. */
+ void setBrightness(int);
+protected:
+ int mFd;
+ fd_set mRfds;
+ QSocketNotifier *mNotifier;
+signals:
+ void vaioEvent(int);
+ // void brightnessChanged(int);
+protected slots:
+ void socketActivated(int);
+};
+
+#endif // KVAIO_DRIVERINTERFACE_H
diff --git a/kmilo/kmilo_kvaio/sonypi.h b/kmilo/kmilo_kvaio/sonypi.h
new file mode 100644
index 0000000..43cfc80
--- /dev/null
+++ b/kmilo/kmilo_kvaio/sonypi.h
@@ -0,0 +1,158 @@
+/*
+ * Sony Programmable I/O Control Device driver for VAIO
+ *
+ * Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net>
+ *
+ * Copyright (C) 2005 Narayanan R S <nars@kadamba.org>
+
+ * Copyright (C) 2001-2002 Alcve <www.alcove.com>
+ *
+ * Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au>
+ *
+ * Copyright (C) 2001 Junichi Morita <jun1m@mars.dti.ne.jp>
+ *
+ * Copyright (C) 2000 Takaya Kinjo <t-kinjo@tc4.so-net.ne.jp>
+ *
+ * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com>
+ *
+ * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef _SONYPI_H_
+#define _SONYPI_H_
+
+#include <linux/types.h>
+
+/* events the user application reading /dev/sonypi can use */
+
+#define SONYPI_EVENT_JOGDIAL_DOWN 1
+#define SONYPI_EVENT_JOGDIAL_UP 2
+#define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3
+#define SONYPI_EVENT_JOGDIAL_UP_PRESSED 4
+#define SONYPI_EVENT_JOGDIAL_PRESSED 5
+#define SONYPI_EVENT_JOGDIAL_RELEASED 6 /* obsolete */
+#define SONYPI_EVENT_CAPTURE_PRESSED 7
+#define SONYPI_EVENT_CAPTURE_RELEASED 8 /* obsolete */
+#define SONYPI_EVENT_CAPTURE_PARTIALPRESSED 9
+#define SONYPI_EVENT_CAPTURE_PARTIALRELEASED 10
+#define SONYPI_EVENT_FNKEY_ESC 11
+#define SONYPI_EVENT_FNKEY_F1 12
+#define SONYPI_EVENT_FNKEY_F2 13
+#define SONYPI_EVENT_FNKEY_F3 14
+#define SONYPI_EVENT_FNKEY_F4 15
+#define SONYPI_EVENT_FNKEY_F5 16
+#define SONYPI_EVENT_FNKEY_F6 17
+#define SONYPI_EVENT_FNKEY_F7 18
+#define SONYPI_EVENT_FNKEY_F8 19
+#define SONYPI_EVENT_FNKEY_F9 20
+#define SONYPI_EVENT_FNKEY_F10 21
+#define SONYPI_EVENT_FNKEY_F11 22
+#define SONYPI_EVENT_FNKEY_F12 23
+#define SONYPI_EVENT_FNKEY_1 24
+#define SONYPI_EVENT_FNKEY_2 25
+#define SONYPI_EVENT_FNKEY_D 26
+#define SONYPI_EVENT_FNKEY_E 27
+#define SONYPI_EVENT_FNKEY_F 28
+#define SONYPI_EVENT_FNKEY_S 29
+#define SONYPI_EVENT_FNKEY_B 30
+#define SONYPI_EVENT_BLUETOOTH_PRESSED 31
+#define SONYPI_EVENT_PKEY_P1 32
+#define SONYPI_EVENT_PKEY_P2 33
+#define SONYPI_EVENT_PKEY_P3 34
+#define SONYPI_EVENT_BACK_PRESSED 35
+#define SONYPI_EVENT_LID_CLOSED 36
+#define SONYPI_EVENT_LID_OPENED 37
+#define SONYPI_EVENT_BLUETOOTH_ON 38
+#define SONYPI_EVENT_BLUETOOTH_OFF 39
+#define SONYPI_EVENT_HELP_PRESSED 40
+#define SONYPI_EVENT_FNKEY_ONLY 41
+#define SONYPI_EVENT_JOGDIAL_FAST_DOWN 42
+#define SONYPI_EVENT_JOGDIAL_FAST_UP 43
+#define SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED 44
+#define SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED 45
+#define SONYPI_EVENT_JOGDIAL_VFAST_DOWN 46
+#define SONYPI_EVENT_JOGDIAL_VFAST_UP 47
+#define SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED 48
+#define SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED 49
+#define SONYPI_EVENT_ZOOM_PRESSED 50
+#define SONYPI_EVENT_THUMBPHRASE_PRESSED 51
+#define SONYPI_EVENT_MEYE_FACE 52
+#define SONYPI_EVENT_MEYE_OPPOSITE 53
+#define SONYPI_EVENT_MEMORYSTICK_INSERT 54
+#define SONYPI_EVENT_MEMORYSTICK_EJECT 55
+#define SONYPI_EVENT_ANYBUTTON_RELEASED 56
+#define SONYPI_EVENT_BATTERY_INSERT 57
+#define SONYPI_EVENT_BATTERY_REMOVE 58
+#define SONYPI_EVENT_FNKEY_RELEASED 59
+
+/* get/set brightness */
+#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
+#define SONYPI_IOCSBRT _IOW('v', 0, __u8)
+
+/* get battery full capacity/remaining capacity */
+#define SONYPI_IOCGBAT1CAP _IOR('v', 2, __u16)
+#define SONYPI_IOCGBAT1REM _IOR('v', 3, __u16)
+#define SONYPI_IOCGBAT2CAP _IOR('v', 4, __u16)
+#define SONYPI_IOCGBAT2REM _IOR('v', 5, __u16)
+
+/* get battery flags: battery1/battery2/ac adapter present */
+#define SONYPI_BFLAGS_B1 0x01
+#define SONYPI_BFLAGS_B2 0x02
+#define SONYPI_BFLAGS_AC 0x04
+#define SONYPI_IOCGBATFLAGS _IOR('v', 7, __u8)
+
+/* get/set bluetooth subsystem state on/off */
+#define SONYPI_IOCGBLUE _IOR('v', 8, __u8)
+#define SONYPI_IOCSBLUE _IOW('v', 9, __u8)
+
+/* get/set fan state on/off */
+#define SONYPI_IOCGFAN _IOR('v', 10, __u8)
+#define SONYPI_IOCSFAN _IOW('v', 11, __u8)
+
+/* get temperature (C) */
+#define SONYPI_IOCGTEMP _IOR('v', 12, __u8)
+
+#ifdef __KERNEL__
+
+/* used only for communication between v4l and sonypi */
+
+#define SONYPI_COMMAND_GETCAMERA 1 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERA 2
+#define SONYPI_COMMAND_GETCAMERABRIGHTNESS 3 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERABRIGHTNESS 4
+#define SONYPI_COMMAND_GETCAMERACONTRAST 5 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERACONTRAST 6
+#define SONYPI_COMMAND_GETCAMERAHUE 7 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERAHUE 8
+#define SONYPI_COMMAND_GETCAMERACOLOR 9 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERACOLOR 10
+#define SONYPI_COMMAND_GETCAMERASHARPNESS 11 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERASHARPNESS 12
+#define SONYPI_COMMAND_GETCAMERAPICTURE 13 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERAPICTURE 14
+#define SONYPI_COMMAND_GETCAMERAAGC 15 /* obsolete */
+#define SONYPI_COMMAND_SETCAMERAAGC 16
+#define SONYPI_COMMAND_GETCAMERADIRECTION 17 /* obsolete */
+#define SONYPI_COMMAND_GETCAMERAROMVERSION 18 /* obsolete */
+#define SONYPI_COMMAND_GETCAMERAREVISION 19 /* obsolete */
+
+int sonypi_camera_command(int command, u8 value);
+
+#endif /* __KERNEL__ */
+
+#endif /* _SONYPI_H_ */