UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Get/Set clipboard data from DBus or other background options in UT

    Scheduled Pinned Locked Moved App Development
    12 Posts 4 Posters 803 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • lduboeufL Offline
        lduboeuf @lduboeuf
        last edited by

        Also dbus-monitor --session when doing a copy/paste from UI reveals the method called

        1 Reply Last reply Reply Quote 1
        • T Offline
          tonton_
          last edited by

          Oh yeah, thanks for these infos πŸ™‚ , i'll take a look after work ! Cheers

          1 Reply Last reply Reply Quote 0
          • T Offline
            tonton_ @lduboeuf
            last edited by

            @lduboeuf
            trying to use the introspectable method to build a call

            The methods :

            <interface name="com.lomiri.content.dbus.Service">
            <method name="GetLatestPasteData">
                  <arg direction="in" type="s" name="surfaceId"/>
                  <arg direction="out" type="ay" name="mimeData"/>
                </method>
                <method name="GetPasteData">
                  <arg direction="in" type="s" name="surfaceId"/>
                  <arg direction="in" type="s" name="pasteid"/>
                  <arg direction="out" type="ay" name="mimeData"/>
                </method>
            

            The call attempt :

            phablet@ubuntu-phablet:~$ dbus-send --session --type=method_call --print-reply --dest=com.lomiri.content.dbus.Service / com.lomiri.content.dbus.Service.GetPasteData
            
            Error org.freedesktop.DBus.Error.UnknownMethod: No such method 'GetPasteData' in interface 'com.lomiri.content.dbus.Service' at object path '/' (signature '')
            

            I'm not sure what i'm doing wrong here, giving the method exists (introspectable). I didn't try to give args on purpose, just to try to build correctly the call first

            arubislanderA 1 Reply Last reply Reply Quote 0
            • arubislanderA Offline
              arubislander @tonton_
              last edited by

              @tonton_ I think not providing any arguments is what is triggering the error. In effect it is saying, there does not exist any method with that name that takes no arguments.

              πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
              Happily running Ubuntu Touch
              Google Pixel 3a (20.04 DEV)
              JingPad (24.04 preview)
              Meizu Pro 5 (16.04 DEV)

              T 1 Reply Last reply Reply Quote 1
              • T Offline
                tonton_ @arubislander
                last edited by

                @arubislander Thank you for the tip, you were right, i "just" have to find the proper way to encode/decode the "array of bytes" output from these dbus calls !

                lduboeufL 1 Reply Last reply Reply Quote 0
                • lduboeufL Offline
                  lduboeuf @tonton_
                  last edited by

                  @tonton_ said in Get/Set clipboard data from DBus or other background options in UT:

                  @arubislander Thank you for the tip, you were right, i "just" have to find the proper way to encode/decode the "array of bytes" output from these dbus calls !

                  I'm not sure if it is even doable as apparently it requires a "surface_id" and an "app_id" so this is something done for UI apps i guess

                  T 1 Reply Last reply Reply Quote 0
                  • T Offline
                    tonton_ @lduboeuf
                    last edited by

                    @lduboeuf not sure either ^^ but if i can decode the bytes array, i believe i can at least retrieve the clipboard ! one step at a time here ! πŸ™‚

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      tonton_
                      last edited by

                      so i get an array of bytes which looks like this :

                      03 00 00 00 34 00 00 00 0a 00 00 00 3e 00 00 00 09 00 00 00 47 00 00 00
                      

                      but longer.
                      It seems to be the clipboard content in mimedata, encoded, but i can't get how to decode it (tested through python or bash for now), sorry if dumb question, i'm getting more familiar with dbus, but not the most skilled around here, that's for sure πŸ™‚
                      Does anyone have some clue about this ? I tried some byte converters to try to identify the encoding, but didn't get through for now...

                      AppLeeA 1 Reply Last reply Reply Quote 0
                      • AppLeeA Offline
                        AppLee @tonton_
                        last edited by AppLee

                        @tonton_

                        Do you know the content of the clipboard.
                        What I would do is copy a known string and try to guess if it's encoded and how.

                        I surmise your device is a 64bit ARM.
                        If I just try a simple ASCII conversion I get : "<LF>4><TAB>G"
                        So something like:

                        
                        4>    G
                        

                        Is it possible?

                        T 1 Reply Last reply Reply Quote 1
                        • T Offline
                          tonton_ @AppLee
                          last edited by tonton_

                          @AppLee
                          thanks for the tip, i tried with ascii converter, didn't think of that, it works πŸ™‚
                          I'll have to parse the resulting ascii (lots of escaped character, and html in it )

                          1 Reply Last reply Reply Quote 1
                          • First post
                            Last post