--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: eeepc-acpi-scripts: Support for disabling and enabling card reader
- From: Alexander Inyukhin <shurick@sectorb.msk.ru>
- Date: Sat, 07 Apr 2012 00:34:23 +0400
- Message-id: <20120406203423.11852.77023.reportbug@shurick.grid.su>
Package: eeepc-acpi-scripts
Version: 1.1.12
Severity: wishlist
Tags: patch
There is a knob in sysfs that allows toggling of card reader state.
Attached patch provides handler scripts for changing and displaying
that state.
The patch uses escaping of notification title as suggested in #667821.
-- System Information:
Debian Release: 6.0.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable'), (193, 'testing'), (192, 'unstable'), (190, 'experimental')
Architecture: i386 (x86_64)
Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to ru_RU.UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/acpilib/cardreader.sh b/acpilib/cardreader.sh
new file mode 100644
index 0000000..86461d9
--- /dev/null
+++ b/acpilib/cardreader.sh
@@ -0,0 +1,31 @@
+# shell library for handling builtin card reader of Asus EeePC
+#
+# to be sourced
+
+CRD_CTL=/sys/devices/platform/eeepc/cardr
+[ -e "$CRD_CTL" ] || CRD_CTL=/proc/acpi/asus/cardr #pre-2.6.26
+# check if card reader is enabled and return success (exit code 0 if it is
+# return failure (exit code 1) if it is not
+#
+# uses the acpi platform driver interface if that is available
+# if not, assume there is not card reader and return false
+cardreader_is_on()
+{
+ if [ -e "$CRD_CTL" ]; then
+ [ $( cat $CRD_CTL ) = "1" ]
+ else
+ false
+ fi
+}
+
+toggle_cardreader()
+{
+ if cardreader_is_on; then
+ echo 0 > $CRD_CTL
+ else
+ if [ -e "$CRD_CTL" ]; then
+ echo 1 > $CRD_CTL
+ fi
+ fi
+}
+
diff --git a/acpilib/notify.sh b/acpilib/notify.sh
index e97e596..a771e22 100644
--- a/acpilib/notify.sh
+++ b/acpilib/notify.sh
@@ -9,6 +9,7 @@ notify() {
ICON_super_hybrid_engine="battery"
ICON_error="error"
ICON_camera="camera"
+ ICON_cardreader="media-flash"
ICON_touchpad="input-touchpad"
ICON_gsm="gsm"
ICON_wifi="network-wireless"
diff --git a/debian/eeepc-acpi-scripts.default.in b/debian/eeepc-acpi-scripts.default.in
index f4d6469..9aea681 100644
--- a/debian/eeepc-acpi-scripts.default.in
+++ b/debian/eeepc-acpi-scripts.default.in
@@ -67,6 +67,8 @@ BLUETOOTH_FALLBACK_TO_HCITOOL='yes'
# on/off any USB bluetooth adapter found.
# - handle_camera_toggle
# Toggles internal camera on/off.
+# - handle_cardreader_toggle
+# Toggles internal card reader on/off.
# - handle_vga_toggle
# Toggles between panel and VGA (as configured above).
# - handle_gsm_toggle
diff --git a/eeepc-acpi-scripts/hotkey.sh b/eeepc-acpi-scripts/hotkey.sh
index c09861c..2ff8aa8 100755
--- a/eeepc-acpi-scripts/hotkey.sh
+++ b/eeepc-acpi-scripts/hotkey.sh
@@ -85,6 +85,24 @@ handle_camera_toggle() {
fi
}
+show_cardreader() {
+ if cardreader_is_on; then
+ notify cardreader 'Card\ reader Enabled'
+ else
+ notify cardreader 'Card\ reader Disabled'
+ fi
+}
+
+handle_cardreader_toggle() {
+ . $PKG_DIR/lib/cardreader.sh
+ if [ -e "$CRD_CTL" ]; then
+ toggle_cardreader
+ show_cardreader
+ else
+ notify error 'Card\ reader unavailable'
+ fi
+}
+
handle_shengine() {
. $PKG_DIR/lib/shengine.sh
handle_shengine "$@"
--- End Message ---