Kernel KB Mouse

From OMAPpedia

Jump to: navigation, search

Contents

[edit] USB Keyboard and Mouse

The kernel currently has g_zero support. The devices keyboard and mouse have been added based on that. The config changes to enable these are.

[edit] Configuration changes

Modify the Zoom2 Defconfig (kernel_omap3/arch/arm/configs/omap_zoom2_defconfig) for the below.

 #
 # Userland interfaces
 #
 # CONFIG_INPUT_MOUSEDEV is not set
 CONFIG_INPUT_MOUSEDEV=y
 CONFIG_INPUT_MOUSEDEV_PSAUX=y
 #
 # Input Device Drivers
 #
 # CONFIG_INPUT_KEYBOARD is not set
 CONFIG_INPUT_KEYBOARD=y
 CONFIG_KEYBOARD_ATKBD=y
 CONFIG_KEYBOARD_TWL4030=y
 # CONFIG_INPUT_MOUSE is not set
 CONFIG_INPUT_MOUSE=y
 CONFIG_MOUSE_PS2=y
 CONFIG_MOUSE_PS2_ALPS=y
 CONFIG_MOUSE_PS2_LOGIPS2PP=y
 CONFIG_MOUSE_PS2_SYNAPTICS=y
 CONFIG_MOUSE_PS2_LIFEBOOK=y
 CONFIG_MOUSE_PS2_TRACKPOINT=y
 CONFIG_INPUT_UINPUT=y
 CONFIG_INPUT_GPIO=y
 CONFIG_INPUT_KEYCHORD=y

The changes will soon be pushed upstream.

[edit] How to install the devices

The devices work the USB OTG. To setup USB OTG, refer to Support Tools page

The devices (keyboard or mouse) have to be connected over a self powered USB 2.0 Hub.

[edit] Building the USB gadget

Once the kernel has been built with the above modified Zoom2 defconfig, build the modules which will generate the g_zero.ko file. To build the modules

 # make CROSS_COMPILE=arm-none-linux-gnueabi- modules
 
 The g_zero.ko file will be at kernel/drivers/usb/gadget

[edit] Installing the devices

Copy g_zero.ko to the SD card or another accessible location.

Once the file system has loaded, install the gadget module.

 # insmod g_zero.ko

This will install the gadget module and the USB devices would be detected. The below logs show the detection of a powered USB Hub and a keyboard device connected to it.

 omapzoom2 login: root
 root@omapzoom2:~# cd /media
 root@omapzoom2:/media# cd mmcblk0p1 
root@omapzoom2:/media/mmcblk0p1# ls g_zero.ko mlo u-boot.bin uImage
root@omapzoom2:/media/mmcblk0p1# insmod g_zero.ko
<7>zero gadget: adding config #3 'source/sink'/bf00485c <7>zero gadget: adding 'source/sink'/cfffc2a0 to config 'source/sink'/bf00485c <7>zero gadget: dual speed source/sink: IN/ep1in, OUT/ep1out <7>zero gadget: cfg 3/bf00485c speeds: high full <7>zero gadget: interface 0 = source/sink/cfffc2a0 <7>zero gadget: adding config #2 'loopback'/bf0047e8 <7>zero gadget: adding 'loopback'/cfffc660 to config 'loopback'/bf0047e8 <7>zero gadget: dual speed loopback: IN/ep1in, OUT/ep1out <7>zero gadget: cfg 2/bf0047e8 speeds: high full <7>zero gadget: interface 0 = loopback/cfffc660 <6>zero gadget: Gadget Zero, version: Cinco de Mayo 2008 <6>zero gadget: zero ready
<6>musb_hdrc musb_hdrc: MUSB HDRC host driver musb_hdrc musb_hdrc: MUSB HDRC host driver <7>PM: Adding info for No Bus:usbmon1 <6>musb_hdrc musb_hdrc: new USB bus registered, assigned bus number 1 <7>usb usb1: default language 0x0409 <7>usb usb1: udev 1, busnum 1, minor = 0 <6>usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 <6>usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 <6>usb usb1: Product: MUSB HDRC host driver <6>usb usb1: Manufacturer: Linux 2.6.31-rc7-omap1-06714-gda06581-dirty musb-hcd <6>usb usb1: SerialNumber: musb_hdrc <7>PM: Adding info for usb:usb1 <7>usb usb1: uevent <7>usb usb1: usb_probe_device <6>usb usb1: configuration #1 chosen from 1 choice <7>usb usb1: adding 1-0:1.0 (config #1, interface 0) <7>PM: Adding info for usb:1-0:1.0 <7>usb 1-0:1.0: uevent <7>hub 1-0:1.0: usb_probe_interface <7>hub 1-0:1.0: usb_probe_interface - got id
<6>hub 1-0:1.0: USB hub found <6>hub 1-0:1.0: 1 port detected
<7>hub 1-0:1.0: standalone hub <7>hub 1-0:1.0: individual port power switching <7>hub 1-0:1.0: no over-current protection <7>hub 1-0:1.0: power on to power good time: 10ms <7>hub 1-0:1.0: 100mA bus power budget for each child
<7>hub 1-0:1.0: local power source is good <7>hub 1-0:1.0: enabling power on all ports <7>PM: Adding info for No Bus:ep_81 <7>PM: Adding info for No Bus:usbdev1.1 <7>PM: Adding info for No Bus:ep_00 root@omapzoom2:/media/mmcblk0p1# <7>usb usb1: uevent <7>hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0000 <7>hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002 <7>hub 1-0:1.0: port 1, status 0101, change 0001, 12 Mb/s <7>hub 1-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
<6>usb 1-1: new high speed USB device using musb_hdrc and address 2 <7>usb 1-1: udev 2, busnum 1, minor = 1 <6>usb 1-1: New USB device found, idVendor=050d, idProduct=0234 <6>usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 <7>PM: Adding info for usb:1-1 <7>usb 1-1: uevent <7>usb 1-1: usb_probe_device <6>usb 1-1: configuration #1 chosen from 1 choice <7>usb 1-1: adding 1-1:1.0 (config #1, interface 0) <7>PM: Adding info for usb:1-1:1.0 <7>usb 1-1:1.0: uevent ... <6>hub 1-1:1.0: 4 ports detected hub 1-1:1.0: 4 ports detected <7>hub 1-1:1.0: standalone hub <7>hub 1-1:1.0: individual port power switching <7>hub 1-1:1.0: individual port over-current protection <7>hub 1-1:1.0: Single TT <7>hub 1-1:1.0: TT requires at most 16 FS bit times (1332 ns) <7>hub 1-1:1.0: Port indicators are supported ... <7>usb 1-1.2: udev 3, busnum 1, minor = 2 <6>usb 1-1.2: New USB device found, idVendor=413c, idProduct=1002 <6>usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
 <6>usb 1-1.2: Product: Dell USB Keyboard Hub
 <6>usb 1-1.2: Manufacturer: Dell
 <7>PM: Adding info for usb:1-1.2
 <7>usb 1-1.2: uevent
 <7>usb 1-1.2: usb_probe_device
 ...
 <7>PM: Adding info for hid:0003:413C:2002.0001
 <7>PM: Adding info for No Bus:input2
 <6>input: Dell Dell USB Keyboard Hub as /devices/platform/musb_hdrc/usb1/1-1/1-1.2/1-  1.2.1/1-1.2.1:1.0/input/input2
 <7>PM: Adding info for No Bus:event2
 generic-usb 0003:413C:2002.0001: input: USB HID v1.10 Keyboard [Dell Dell USB Keyboard Hub] on usb-musb_hdrc-1.2.1/input0
 <7>PM: Adding info for No Bus:ep_81
 <7>usb 1-1.2.1: adding 1-1.2.1:1.1 (config #1, interface 1)
 <7>PM: Adding info for usb:1-1.2.1:1.1
 <7>usb 1-1.2.1:1.1: uevent


The devices are plug and play and you can add or remove devices. The below logs show the events when a mouse is connected to the USB Hub

 root@omapzoom2:/media/mmcblk0p1# <7>hub 1-1:1.0: state 7 ports 4 chg 0000 evt 0010
 <7>hub 1-1:1.0: port 4, status 0301, change 0001, 1.5 Mb/s
 <7>hub 1-1:1.0: debounce: port 4: total 100ms stable 100ms status 0x301
 <7>hub 1-1:1.0: port 4 not reset yet, waiting 10ms
 <6>usb 1-1.4: new low speed USB device using musb_hdrc and address 5 
<7>hub 1-1:1.0: port 4 not reset yet, waiting 10ms <7>usb 1-1.4: skipped 1 descriptor after interface <7>usb 1-1.4: default language 0x0409 <3>usb 1-1.4: device v046d pc016 is not supported <7>usb 1-1.4: udev 5, busnum 1, minor = 4 <6>usb 1-1.4: New USB device found, idVendor=046d, idProduct=c016 <6>usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0 <6>usb 1-1.4: Product: Optical USB Mouse <6>usb 1-1.4: Manufacturer: Logitech <7>PM: Adding info for usb:1-1.4 <7>usb 1-1.4: uevent <7>usb 1-1.4: usb_probe_device <6>usb 1-1.4: configuration #1 chosen from 1 choice <7>usb 1-1.4: adding 1-1.4:1.0 (config #1, interface 0) <7>PM: Adding info for usb:1-1.4:1.0 <7>usb 1-1.4:1.0: uevent <7>usbhid 1-1.4:1.0: usb_probe_interface <7>usbhid 1-1.4:1.0: usb_probe_interface - got id <7>PM: Adding info for hid:0003:046D:C016.0003 <7>PM: Adding info for No Bus:input4
<6>input: Logitech Optical USB Mouse as /devices/platform/musb_hdrc/usb1/1-1/1-1.4/1-1.4:1.0/input/input4 <7>PM: Adding info for No Bus:mouse1 <7>PM: Adding info for No Bus:event4 <6>generic-usb 0003:046D:C016.0003: input: USB HID v1.10 Mouse [Logitech Optical USB Mouse] on usb-musb_hdrc-1.4/input0 <7>PM: Adding info for No Bus:ep_81 <7>PM: Adding info for No Bus:usbdev1.5 <7>PM: Adding info for No Bus:ep_00

To list the devices,

 # lsusb
 root@omapzoom2:/media/mmcblk0p1# lsusb
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 001 Device 002: ID 050d:0234 Belkin Components F5U234 USB 2.0 4-Port Hub
 Bus 001 Device 003: ID 413c:1002 Dell Computer Corp. Keyboard Hub
 Bus 001 Device 004: ID 413c:2002 Dell Computer Corp. SK-8125 Keyboard
 Bus 001 Device 005: ID 046d:c016 Logitech, Inc. M-UV69a/HP M-UV96 Optical Wheel Mouse
Personal tools
Namespaces
Variants
Views
  • Read
  • Edit
  • View history
Actions
Navigation
Toolbox
  • What links here
  • Related changes
  • Special pages
  • Printable version