Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support keySimulator in remotecontrollers #120

Conversation

tamilarasi-t12
Copy link
Contributor

Added the KeySimulator feature as a new module within the existing Python Raft framework remote controller module.

closes #119

@CLAassistant
Copy link

CLAassistant commented Nov 26, 2024

CLA assistant check
All committers have signed the CLA.

@rdkcmf-jenkins
Copy link

Coverity detected 1 issue; a quality concern.

@Ulrond Ulrond linked an issue Nov 27, 2024 that may be closed by this pull request
@Ulrond Ulrond requested review from TB-1993 and Ulrond November 27, 2024 11:11
@Ulrond Ulrond added the enhancement New feature or request label Nov 27, 2024
@Ulrond
Copy link
Contributor

Ulrond commented Nov 27, 2024

let me check if we can accept this with merge point etc. normally tier1 developers would be able to create branches.

Copy link
Contributor

@Ulrond Ulrond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok except for that minor change to upgrade the examples

@tamilarasi-t12
Copy link
Contributor Author

We forked the repository and created a branch because we do not have the option to create a branch directly in the original repository.

Copy link
Contributor

@Ulrond Ulrond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's an assumption likely due to incorrect documentation that sendKey takes in a dictionary, it does not... it takes in a rcCode from rdCode.py, and that's used in all the translation tables and all the code.

Your changes assume that a key dict goes in and therefore will not correctly translate from rcCodes to the dictiomnary.

I've raised a issue to make the code clear, but I suspect your code change will break raft users.

#122

To perform any changes to raft, we have to ensure we test raft with raft tests, in this case there's tests here -> https://github.com/rdkcentral/python_raft/blob/master/tests/remoteController_test.py

Had these been used to test raft, it may have been noticed that rcCodes are used as the input to the commonRemote, but any changes to the core will require upgrades to the basic tests to ensure that the changes comply with the requirements of the core.

@tamilarasi-t12
Copy link
Contributor Author

tamilarasi-t12 commented Dec 3, 2024

Reason for removing the below code due to the issues mentioned below:

keyDictionary = {}
       for key, val in config.items():
           if isinstance(val, dict):
               for k, v in val.items():
                   keyDictionary[k] = v 
           else:
               keyDictionary[key] = val
       return keyDictionary

Observation:

I have cloned the python-raft repository and followed the steps to run the remoteController_test.

  • Added the KeySimulator remote feature within the RemoteController module
    File Name: Added keySimulator.py
    File Name: Updated the commonRemote.py

  • Updated the rack configuration's remote controller section to include the keySimulator type.

     remoteController:
                          # [ remoteController: ]
                          # [ type: "olimex" ip: "192.168.0.17" port: 7 map: "llama_rc6", config: "remote_commander.yml" ]
                          # [ type: "skyProc" map: "skyq_map", config: "remote_commander.yml" ]
                          # [ type: "None" ]
                          type: "keySimulator"
                          map: "keysimulator_xione"
                          ip: "192.168.50.182" 
                          port: 10022
                          username: "root"
                          password: ''
                          config: "./examples/configs/keymap.yml"

Changes in commonRemote.py

elif self.type == "keySimulator":
         self.remoteController = keySimulator (self.log, remoteConfig)

Issue 1:
The keymap configuration file is not found in the Repository.

image

Solution:
Added keymap.yml as per the documentation ( https://github.com/rdkcentral/python_raft/wiki/Common-Remote ).

remoteMaps:
  remoteCommanderMap0:
    name: "keysimulator_xione"
    prefix: "keySimulator -k"
    codes:
      POWER: "power"
      HOME: "home"
      GUIDE: "guide"
      SKY: "sky"
      NUM_0: "0"

Issue 2:
After adding keymap.yml, the below error message was observed.

image
image

Note:
Are there any missing component changes or pending code updates relevant to remotecontroller components in the Python Raft repository?

Solution 1:
Changes are already there in the Pull request.
Solution 2:
Even if we make just this one change, everything will work fine.

        keyDictionary = {}
        for key, val in config.items():
            if isinstance(val, dict):
                for k, v in val.items():
                    keyDictionary[k] = v 
            else:
                keyDictionary[key] = val
        #return keyDictionary
        return keyDictionary.get("remoteMaps")

We are proposing the solution 2 to make the minimal changes in the Python Raft Repository.

For answering this query:

Your changes assume that a key dict goes in and therefore will not correctly translate from rcCodes to the dictionary.

When running remoteController_test.py, the function getMappedKey retrieves keys from rcCodes.py and converts them using keymap.yml. Our recent code changes ensure that remoteController_test.py is functioning correctly.

@tamilarasi-t12 tamilarasi-t12 requested a review from Ulrond December 4, 2024 05:59
TB-1993
TB-1993 previously approved these changes Dec 4, 2024
Copy link
Contributor

@TB-1993 TB-1993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Ulrond
Ulrond previously approved these changes Dec 5, 2024
@tamilarasi-t12 tamilarasi-t12 dismissed stale reviews from Ulrond and TB-1993 via 9f58795 December 5, 2024 09:14
@tamilarasi-t12
Copy link
Contributor Author

@TB-1993, @Ulrond I updated the code as per our previous discussion. I made the changes according to the rdk_keymap.yml design in commonRemote.py and tested it. Could you please look at it once?

Copy link
Contributor

@TB-1993 TB-1993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok lets merge this, it still won't work as commonRemote is broken, but I already have a commit with the fix, I just don't have permissions to push it to your fork.

framework/core/commonRemote.py Show resolved Hide resolved
@TB-1993 TB-1993 merged commit d6e5ecb into rdkcentral:develop Dec 12, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeySimulator for Python Raft Framework Remote Controller
5 participants