12 Replies Latest reply on Sep 13, 2016 5:21 AM by PaulaK

    USB keyboard - editing menuconfig


      Hi all,


      I'm trying to edit my menuconfig file to add usb keyboard support to my Intel Galileo and I'm not getting anywhere.

      Here are my modifications on the menuconfig file (I tested it and the changes are being applied to my build):


      1. Device drivers -> Input device support -> <*> Event Interface and [*] Keyboards
      2. Device drivers -> [*] USB support -> <*> Support for Host-side USB
      3. Device drivers -> HID Support -> USB HID support -> <*> USB HID transport layer


      That is all the changes that I did to the BSP v. image-full kernel.


      When I boot this image with my usb keyboard connected, it throws this errors:


      My current .config file for keyboard is:


      # CONFIG_KEYBOARD_ADP5588 is not set

      # CONFIG_KEYBOARD_ADP5589 is not set


      # CONFIG_KEYBOARD_QT1070 is not set

      # CONFIG_KEYBOARD_QT2160 is not set

      # CONFIG_KEYBOARD_LKKBD is not set

      # CONFIG_KEYBOARD_GPIO is not set


      # CONFIG_KEYBOARD_TCA6416 is not set

      # CONFIG_KEYBOARD_TCA8418 is not set

      # CONFIG_KEYBOARD_MATRIX is not set

      # CONFIG_KEYBOARD_LM8323 is not set

      # CONFIG_KEYBOARD_LM8333 is not set

      # CONFIG_KEYBOARD_MAX7359 is not set

      # CONFIG_KEYBOARD_MCS is not set

      # CONFIG_KEYBOARD_MPR121 is not set

      # CONFIG_KEYBOARD_NEWTON is not set


      # CONFIG_KEYBOARD_SAMSUNG is not set


      # CONFIG_KEYBOARD_SUNKBD is not set

      # CONFIG_KEYBOARD_XTKBD is not set


      I've also attached my entire .config file for CONFIG_USB_* and the entire file just in case (allconfig.txt).


      Could somebody please help me? (I'm facing the same issue as describe in another thread How to configure USB Keyboard on Galileo? )




        • 1. Re: USB keyboard - editing menuconfig
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi Paula,

          Just to make sure, you say that you’re experiencing the same behavior as the user on this case https://communities.intel.com/thread/101913, so by that you mean that the USB keyboard works only when choosing boot option, right?
          Also, you’re getting those errors when booting with the USB keyboard already connected, but what happens when you connect the USB keyboard after the Galileo has finished booting?
          You might also want to take a look at this thread: http://cateee.net/lkddb/web-lkddb/USB_KBD.html.


          • 2. Re: USB keyboard - editing menuconfig

            Hi Pablo,


            Yes, my keyboard works fine until the boot process finishes.(this happpened even before I made those modifications on menuconfig)


            If I connect the keyboard after the boot process, I get an output saying that the HID device was found. But when a type nothing happens on the terminal.




            • 3. Re: USB keyboard - editing menuconfig
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hi Paula,

              I believe your configuration in the menuconfig is correct because your device is being recognized as an HID. However, it seems like it’s necessary to tell Linux how to handle these keyboard inputs by using the event triggered by the keyboard connection.  
              Could you please let me know what files you have under /dev/input?


              • 4. Re: USB keyboard - editing menuconfig

                Hi Pablo,


                I'm not so sure about my menuconfig, because before I changed those files my keyboard was already recognized as an HID device.


                My /dev/input before connecting the keyboard

                     event0     event1


                After plugging in the keyboard:


                root@quark:~# [  295.150233] usb 2-1: new low-speed USB device number 2 using ohci-pci

                [  295.427954] input: USB USB Keyboard as /devices/pci0000:00/0000:00:14.4/usb2/2-1/2-1:1.0/0003:1A2C:0C21.0001/input/input2

                [  295.441914] hid-generic 0003:1A2C:0C21.0001: input: USB HID v1.10 Keyboard [USB USB Keyboard] on usb-0000:00:14.4-1/input0

                [  295.526981] input: USB USB Keyboard as /devices/pci0000:00/0000:00:14.4/usb2/2-1/2-1:1.1/0003:1A2C:0C21.0002/input/input3

                [  295.541135] hid-generic 0003:1A2C:0C21.0002: input: USB HID v1.10 Mouse [USB USB Keyboard] on usb-0000:00:14.4-1/input1



                     by-id    by-path  event0   event1   event2   event3



                I'm really intrigued by this. :/

                • 5. Re: USB keyboard - editing menuconfig
                  Intel Corporation
                  This message was posted on behalf of Intel Corporation

                  Hi Paula,


                  Did you run those commands with your modified image (with the HID changes in menuconfig) or with the standard image?
                  Regarding your configuration, it is strange that your Galileo is still detecting the keyboard as an HID device even without making the changes in the kernel. My guess is that even if recognized it won’t work until you change the menuconfig values.
                  Now, I don’t know if you have been searching about what I told you in my last reply (that you need to tell Linux how to handle the inputs from your keyboard), I kept doing some research and found this link which explains briefly that information,
                  They use the keyboard “events” and pass this information to a code that then handles the input. You can check their code snippet.



                  • 6. Re: USB keyboard - editing menuconfig

                    hi pablo,


                    I run those commands with my modified image and the original provided by Intel, the results are the same.


                    I tried editing my menuconfig similar to the suggested on website, but our menuconfig don't provide the following option Device Drivers --> HID Devices –> USB Human Interface Device (full HID) support. So I really don't know which files I have to modify on menuconfig in order to make my USB keyboard working.


                    Could you get a USB keyboard working on Intel Galileo Gen 2 ?


                    Thanks and sorry for the late reply.

                    • 7. Re: USB keyboard - editing menuconfig
                      Intel Corporation
                      This message was posted on behalf of Intel Corporation

                      Hi Paula,

                      I haven’t tried yet, but I could run some tests. I’m not sure if I have access to a USB keyboard that’s not being used but I will look for one. I’ll let you know if I have updates.


                      • 8. Re: USB keyboard - editing menuconfig
                        Intel Corporation
                        This message was posted on behalf of Intel Corporation

                        Hi Paula,

                        Using the latest MicroSD* card image found on the Downloads website https://software.intel.com/en-us/iot/hardware/galileo/downloads, together with SKeylogger, we were able to get data from the keyboard. The keyboards we used were a Logitech K120 and a Kensington, both of them seem to work with the Galileo board. You could attempt to use SKeylogger in your custom image build and see if that works, just make sure your board has access to the internet to be able to clone the repository. 
                        Also make sure the keyboard is connected to the Galileo. 

                        Here are the steps we followed using the latest image: 
                        1. Make sure the Galileo is booting up from the SDCard, to do so the latest image version should be the following: 
                        root@galileo:~# cat /etc/version 

                        2. Check your network connection, the easiest way would be to connect an Ethernet cable to the Galileo board. Also you can connect the board via WiFi following this guide https://software.intel.com/en-us/node/519955 
                        We checked the Galileo connection using ping: 
                        root@galileo:~# ping google.com
                        PING google.com ( 56 data bytes 
                        64 bytes from seq=0 ttl=52 time=7.381 ms 
                        64 bytes from seq=1 ttl=52 time=7.027 ms 
                        64 bytes from seq=2 ttl=52 time=7.173 ms 
                        64 bytes from seq=3 ttl=52 time=7.070 ms 
                        --- google.com ping statistics --- 
                        4 packets transmitted, 4 packets received, 0% packet loss 
                        round-trip min/avg/max = 7.027/7.162/7.381 ms 

                        3. Now that you have internet access, proceed to clone the SKeylogger repository (steps and information can be found here https://github.com/gsingh93/simple-key-logger
                        root@galileo:~# git clone https://github.com/gsingh93/simple-key-logger.git 
                        Cloning into 'simple-key-logger'... 
                        remote: Counting objects: 48, done. 
                        remote: Total 48 (delta 0), reused 0 (delta 0), pack-reused 48 
                        Unpacking objects: 100% (48/48), done. 
                        Checking connectivity... done. 

                        4. Change directories to the cloned repository and run the "make" command: 
                        root@galileo:~# cd simple-key-logger/ 
                        root@galileo:~/simple-key-logger# make 
                        gcc -g -Wall -c -o skeylogger.o skeylogger.c 
                        gcc -g -Wall -c -o key_util.o key_util.c 
                        In file included from key_util.c:3:0: 
                        key_util.c: In function 'getKeyText': 
                        util.h:6:46: warning: typedef '__C_ASSERT__' locally defined but not used [-Wunused-local-typedefs] 
                        #define ASSERT_ON_COMPILE(expn) typedef char __C_ASSERT__[(expn) ? 1 : -1] 

                        key_util.c:86:4: note: in expansion of macro 'ASSERT_ON_COMPILE' 
                        ASSERT_ON_COMPILE(ARRAY_SIZE(key_names) == ARRAY_SIZE(shift_key_names)); 

                        https://github.com/gsingh93/simple-key-logger.gitgcc -g -Wall -c -o options.o options.c 
                        gcc -g -Wall -c -o config.o config.c 
                        gcc -g -Wall skeylogger.o key_util.o options.o config.o -o skeylogger 

                        5. Simply just run the skeylogger binary. Make sure the keyboard is connected to the Galileo board, otherwise the terminal may throw some error messages. 
                        root@galileo:~/simple-key-logger# ./skeylogger 

                        6. You can print the keystrokes found on the log file in the following directory: 
                        root@galileo:~/simple-key-logger# cat /var/log/skeylogger.log 
                        <RShift>This is a test entering characters from a keyboard to the <RShift>Galileo board.<Enter><ESC><LCtrl><LAlt><LShift>

                        Let us know if this helps,


                        • 9. Re: USB keyboard - editing menuconfig
                          Intel Corporation
                          This message was posted on behalf of Intel Corporation

                          Hi Paula,

                          Do you have updates on this case? Have you been able to try our suggestions?


                          • 10. Re: USB keyboard - editing menuconfig

                            HI Pablo,


                            Sorry for taking so long to reply.


                            Thanks for the detailed tutorial, I was able to read the entries from my keyboard, but that wasn't quite what I was aiming for. What I had in mind was to connect any USB keyboard and be able to send commands to the terminal, as a regular keyboard. That's why I thought in kernel editing, because it seems like the USB host is not configured to accept "external" input devices.


                            Nevertheless thank you for suggestion, I really appreciate your effort.




                            • 11. Re: USB keyboard - editing menuconfig
                              Intel Corporation
                              This message was posted on behalf of Intel Corporation

                              Hi Paula,

                              You’re more than welcome and I’m sorry this is not what you were hoping for. But maybe you can use our work or at least part of it to try to get the behavior you expect. Hopefully, you’ll find a better way to implement it.  


                              • 12. Re: USB keyboard - editing menuconfig

                                Hi Pablo,


                                Yes of course.

                                Thank you for all your kind help and support.