8 Replies Latest reply on Apr 7, 2017 1:28 AM by paolo.zandonella_2009946

    BLE Keyboard and Mouse HID on the same device

    paolo.zandonella_2009946

      Using CYBLE-212019 and starting from the 'BLE Hid Keyboard' design example of 'PSoC Creator' I have developed a Bluetooth PC keyboard. Now I have to implement a Bluetooth mouse on the same device.

         

      I've checked the 'BLE Hid Mouse' example and it works and I've tried to merge the two projects copying the mouse service inside the keyboard project and the BLE mouse event management in the code.

         

      Currently it does not work neither the keyboard nor the mouse but may be I've forgotten to copy something.

         

      What I like to know if it's possible to have mouse and keyboard profiles implemented on the same device and, if possible, some info about how to do it.

         

      Many thanks.

         

      Paolo

        • 1. Re: BLE Keyboard and Mouse HID on the same device
          e.pratt_1639216

          Yes it is possible. Here is a thread with similar questions, and links to example projects that should be enough to answer your questions/get you started:

             

          HID BLE Mouse and Keyboard Link

          • 3. Re: BLE Keyboard and Mouse HID on the same device
            paolo.zandonella_2009946

            As attachment I've added a simple project derived from 'PSoC Creator' HID_Keyboard example where I've tried to add mouse function. I've added two new reports (Mouse Report and Boot Mouse Input Report) and the relative software to send data. Using Wireshark to log info sent by the device (CYBLE-212019 evaluation board on Pioneer Kit) I see that the mouse data are sent but the PC ignores them. I suppose I've to tell to the PC that the device is also a mouse but I don't know how. May be adding some infos to Report Map?

               

            Many thanks.

               

            Paolo

            • 4. Re: BLE Keyboard and Mouse HID on the same device
              e.pratt_1639216

              I've only dabbled in HID reports, and it's been some time, but I would suspect that you need to have info for both the mouse and keyboard in the report map in order for the PC to recognize them as such. 

                 

              Under the BLE component, looking at the Report Map, I'm thinking there is a report map per HID device, and as far as the PC is concerned, both the mouse/keyboard are separate HID devices?

                 

              Hence, I would create a separate Human Interface Device service, and rewrite all of the attributes to be appropriate for an HID mouse.

                 

              You would then need to write and handle a second HID service callback handler to handle the Mouse events just as the keyboard events are currently being handled in hids.c

                 

              Depending on the implementation of the receiving side, this could simply work, or it may be wrong. I'm not sure how the HID over BLE protocol is setup, but I suspect if it is trying to stay true to HID, then each of the mouse and keyboard would need their own HID service and attributes.

              • 5. Re: BLE Keyboard and Mouse HID on the same device
                e.pratt_1639216

                According to the included PDF file with the example project, you will need windows 8 or higher to get it setup and running, and when you do so it requires installing a BLE keyboard through use of the control panel. You will probably need to do something similar for a BLE mouse device?

                • 6. Re: BLE Keyboard and Mouse HID on the same device
                  paolo.zandonella_2009946

                  Many thanks for your answers.

                     

                  Now mouse and keyboard are working. As in the application linked in the thread you told me about it's necessary to add the mouse reports and the report map to the keyboard HID device. I've tried many times to modify the report map using the graphic user interface but I wasn't able to do it. So I've saved on file the report map of your thread application, of the HID keyboard and HID mouse applications and then using a text editor I've merged the last two looking at the thread one and finally I loaded it in the HID keyboard application report map. I hope and I'm sure there is a better mode to do it.

                     

                  I've attached the working project.

                  • 7. Re: BLE Keyboard and Mouse HID on the same device
                    e.pratt_1639216

                    Hmmm, I don't have much time to look into it, but if you got it working then kudos to you :D

                       

                    To modify the BLE profile: When you select the Report Map service in the profile, it will show a green plus in the right side of the component window, and if you mouse over that the tool tip shows "Add HID item", which then adds a "Usage_Page_ item to the report map. You can then select the mouse Usage and Collection items from that drop-down selection to add the Mouse HID report to the report map. (Although editing it with a text-file editor is perfectly valid).

                       

                    It seems to work just fine for me to use it, perhaps you misunderstood how to use the gui, which is understandable (it is rather confusing at times).

                       

                    It displays the profile services and attributes as if they were files in a file-system. But, that is a false notion, and thus if you just use the "Add HID Item" button, you should be able to add and modify HID values within the Report Map to add the HID mouse to the profile.

                       

                    Nicely done on getting it working Paolo;

                       

                    I've attached a screenshot showing the button and Report Map fields that get added as a result/

                    • 8. Re: BLE Keyboard and Mouse HID on the same device
                      paolo.zandonella_2009946

                      Yes I know it isn't the right way to do it but the user interface is not so friendly and is not simple to know what insert. I haven't found any documentation about that. It would be useful to add a complete service from a predefined list. Anyway I think Cypress have done a good job because Bluetooth is complex and they give a lot a examples of applications. The problems arise when you have to do something that different.

                         

                      Thank you for your help.