no-input-recovery

  • Launchpad Entry: no-input-recovery

  • Created:2008-11-19 06:09:34

  • Contributors: Bryan Quigley,

  • Packages affected:

ToDO

(I'm doing in this order)

  1. Investigate modifying gnome-keyboard-properties to better suit needs
  2. Make the messages translatable
  3. Make it KDE friendly (KDE user wants to help do this?)
  4. Make sure it is XFCE friendly (XFCE user?)
  5. Make it * friendly (* user?)

Summary

On bootup:

  • No Keyboard, but mouse: ask if user wants to start on-screen keyboard
  • No Mouse, but keyboard: ask if user wants to enable mousekeys (numlock keys as mouse), alert user of how to turn on and off

Release Note

Now on systems without a detected mouse or keyboard Ubuntu will try to help the user by providing them with a virtual mouse or keyboard.

Rationale

When I start the Ubuntu LiveCD and my keyboard or mouse isn't detected that is very annoying. We cannot expect people to know shortcut keys to start a mouse, or how to turn the on-screen keyboard on.

Use Cases

Aiden just got back from a LAN party and left his keyboard there. We start a virtual keyboard so he can send a message on Pidgin to his friends to get his keyboard back.

Sharon just got back from a LAN party and left her mouse there. We start MouseKeys so she can navigate to Pidgin to ask her friends to get her mouse back.

Bert is testing a liveCD and the keyboard isn't detected by the kernel for some silly reason. We launch a virtual keyboard so Bert can debug.

Assumptions

We assume every user and device wants/needs a pointer and keyboard. Some users might not... What should we do for them? Ubuntu Mobile might have to turn this off?

There isn't a better place to put this log, like Upstart or Hal?

Design

A file say 91-no-input-recovery is placed in /etc/X11/Xsession.d/ where it performs necessary logic to determine if a keyboard or mouse is present and then start a virtual one.

Implementation

Currently this might only require a single file in /etc/X11/Xsession.d/

Code 91-no-input-recovery

Something like (does work):

#!/bin/sh

# If zero no keyboard, if non-zero hopefully there is one
bool_keyboard=`xinput list --short | grep "XExtensionKeyboard" -c`
#bool_keyboard=0

# If zero no mouse, if non-zero hopefully there is one
bool_mouse=`xinput list --short | grep -v "emul" | grep "XExtensionPointer" -c`
#bool_mouse=0

bool_any=`expr $bool_mouse + $bool_keyboard`

if [ $bool_any = 0 ] 
then
        zenity --warning --title="No Input Devices Detected" --text="No Input Devices Detected, please plug some in"
else
        if [ $bool_keyboard = 0 ]
        then
                zenity --question --title="No Keyboard Detected" --text="Would you like an onscreen keyboard?" --ok-label="Launch Onscreen Keyboard" --cancel-label="Do Nothing"
                        if [ $? = 0 ]
                        then onboard &
                        fi
        fi

        if [ $bool_mouse = 0 ]
        then 
                zenity --question --title="No Mouse Recovery" --text="
No mouse has been detected
Here are some keyboard hints to help you out:

Alt-F1 - Brings up the Applications Menu
Alt-F2 - Brings up the Run Applications Window
Alt-Tab - Move between Windows
Tab - Navigate through fields/options
Arrow Keys - Navigate through fields/options
Ctrl-Alt-D - Minimizes All Windows and moves cursor to desktop

In System - Preferences - Keyboard there is an option to use the numberpad as a mouse.  We can do that for you, if you like.
" --ok-label="Launch Mouse Keys Configuration" --cancel-label="Do Nothing"
                if [ $? = 0 ]
                then gnome-keyboard-properties &
                fi
        fi
fi

Test/Demo Plan

  • Keyboard, No Mouse
  • Mouse, No Keyboard
  • No Keyboard, No Mouse

Unresolved issues

None ATM

BoF agenda and discussion

Comments

  • Best to make the dialog magically go away when the user plugs in the device that's missing as well. ScottRitchie


CategorySpec

Specs/no-input-recovery (last edited 2009-02-02 21:26:53 by c-24-0-106-77)