Languages

Menu
Sites
Language
[ANSWERED] How to get device serial number?

Both in https://developer.tizen.org/forums/native-application-development/serial-number-tizen-phone and in https://developer.tizen.org/zh-hans/forums/native-application-development/get-device-serial-number?langswitch=zh-hans, somebody suggested to use TizenId. But that's not it, TizenId gives some "randomly generated value based on model name", according to the doc (and my experiment).

 

This is the 3rd time this question is asked (according to Google) and people says it's third time lucky.

So here we go: how to get device serial number? The value that is shown in Gear Info / About Device / Serial Number?

 

Platform: Tizen 2.3.2, Gear S3

 

Edited note: the question has been answered. The third time is indeed lucky.

Edited by: James B on 01 Mar, 2017
View Selected Answer

Responses

26 Replies
Peter Wegner

Can you maybe more explain what you try or need?

 

If I remember correct...

DUID is Base64 encode... Serial Number...

 

Maybe check this here:

https://developer.tizen.org/forums/general-support/private-distribution-tizen-wearable-apps

sdb shell /opt/etc/duid-gadget

 

Only as info...

No idea what you try to hack...

:) :)

 

Best Regards

James B

Thanks Peter.

I need to get the serial number from the native API, as I need to identify the device that would be running the app; and it is much preferable that whatever ID that I use, is visible to the device owner as well. Device serial number sounds like the best idea since it is prominently featured on the device's "About device" screen. This device serial number is an alphanumeric string, something like "R3AH800L9XX" on my particular device.

sdb shell /opt/etc/duid-gadget returns not the serial number, it returns some other number (not the TizenId as well). I tried to decode the base64-looking string, but it decodes to garbage ...

By the way - who's great idea is it to have an executable in /opt/etc ??? :(

Peter Wegner

I know how SN looks... as for me in "Mobile" world it was/is very helpfull to identify correct Firmware with Kies 3...

 

Please not forget... SN is part of Security blabla Crypto concept...

 

B.d boys change SN, IMEI etc... as they have all mandatory Certs... :) :)

 

Joke.

I can NOT remember in 2 years + with Z Mobiles...

That 3d party apps can display SN...

Maybe someone correct me... maybe AIDA64 ?

 

Maybe minimum Partner Privilege or Platform P. required... to see human readable SN...

 

For me Tizen Store (App) shows "DUID"... in Base64...

And if I convert this String... I see my SN 2 times...

But I have only SM-Z130H

 

DUID from TS not same what this Command shows:

sdb shell /opt/etc/duid-gadget

 

Only as info.

 

Best Regards

James B

Thanks.

Quite annoying isn't it. I can work out the privilege if needed, but where is the !@#$^% API to call it? It's not even in the KNOX API. Assuming you're right that the serial number is tied into certs and whatnot ... I found this a very bad practice. Serial number is usually used for asset management. Hiding it from the API is a !@#^%$^%$ design. They could have used that DUID ... whatever it is ... for the cert/crypto thing. Leave serial number for what it is.

 

Anyway, all I want to do is to read the serial number (not trying to change it).

 

I could read the IMEI, I could read the MAC address. Why couldn't I read the S/N ???

Peter Wegner

serial_path /csa/imei/serialno.dat

https://build.tizen.org/package/rdiff?linkrev=base&package=system-info&project=Tizen%3ACommon&rev=8

Here in this way I found human readable SN... as file.

Ehm... root "maybe" required...

 

Tizen Store seems to work with:

engine.c: read_config(3413) > duid from get_device_id:

 

Displayed as Base64 encoded text string...

 

Best Regards

James B

Good find, thanks Peter.

Unfortunately - as you said - it "requires root". Under sdb shell, I got permission denied error trying to list /csa. So no go for me ...

Peter Wegner

And if you search little bit through Source Code... RPMs and so on...

https://build.tizen.org/package/binaries?package=capi-system-info&project=Tizen%3A2.3.1%3AWearable&repository=target

To understand how it work...

 

Bypass QA is later an different task... :)

 

Best Regards

Peter Wegner

Few tests later...

 

Compared value/string from:

sdb shell /opt/etc/duid-gadget

and

Tizen Studio/SDK in Connection Explorer...

 

1:1 same text string... and I am pretty sure this Base64 encoded...

 

Only question is, what is inside... MD5 Hash or SHA1 Hash or other Encryption method...

 

As ""DUID"" from Tizen Store app is not same string or Value...

 

Will try to find an way to display same text string like Serial Number... with normal commercial device..

As all ways I found require root... :)

 

Short tried with AT Commands... as also Logdump of CP contains SN... but without last Digit...

This remember me about IMEI... last Digit is computed..

 

Best Regards

James B

I downloaded the whole shebang from Tizen's git repo.

Here's what I found: /opt/etc/duid-target is here: https://git.tizen.org/cgit/framework/security/libcryptsvc/tree/gadget/duid-gadget.c?h=tizen_2.3.1

If you follow the path, you will find that it is outputting SHA1 of a mangled array coming from /sys/block/mmcblk0/device/cid, which basically encodes the information from the EMMC that holds the OS (information like manufacturer id, oemid, serial number of the EMMC, etc etc).

While the one you find in tizenid SystemInfo key is basically output of /usr/bin/tizen_id, which you can't run due to, oh well, security, even though the information it produces is just SHA1 of a mix of /dev/random and model number you can get from /etc/config/model-config.xm. tizenid source is here: https://git.tizen.org/cgit/framework/api/system-info/tree/src/tizenid/tizenid.c?h=tizen_2.3.1

So no, both of them are false starts, although the duid-gadget is definitely useful in another context, as you have found.

 

The serial number /csa/imei/serialno.dat is referred to by this file: https://git.tizen.org/cgit/framework/system/deviced/tree/src/board/board-info.c?h=tizen_2.3.1.
Unfortunately most of the methods that reads this file is static. However, if you scroll down, you will see that this basically registers itself as a dbus provider, with a method called "GetSerial". Now if someone can look into how you can call this dbus service, that would probably be the way to get it. If not blocked by yet another security measures.

 

All this hard work to get an information that should be available in the first place ... :(


 

 

Mark as answer
Onur Şahin

about dbus, time to do some Introspect :)

dbus-send --system           \
  --dest=org.freedesktop.DBus \
  --type=method_call          \
  --print-reply               \
  /org/freedesktop/DBus       \
  org.freedesktop.DBus.ListNames

this will print all available services in dbus. Output on 2.3.1 circle wearable emulator;

method return sender=org.freedesktop.DBus -> dest=:1.858 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string ":1.7"
      string ":1.9"
      string "com.samsung.sapd"
      string "org.freedesktop.systemd1"
      string "org.x.dbg.server0"
      string "org.pulseaudio.Server"
      string "com.tcore.ps"
      string "net.netconfig"
      string ":1.61"
      string ":1.40"
      string ":1.41"
      string ":1.64"
      string ":1.20"
      string ":1.42"
      string ":1.65"
      string ":1.21"
      string ":1.43"
      string ":1.44"
      string ":1.22"
      string ":1.45"
      string ":1.24"
      string ":1.69"
      string ":1.47"
      string ":1.25"
      string ":1.26"
      string ":1.27"
      string "net.connman"
      string ":1.28"
      string ":1.29"
      string ":1.833"
      string ":1.834"
      string ":1.858"
      string "org.tizen.alarm.manager"
      string ":1.818"
      string ":1.819"
      string "org.PulseAudio2"
      string "org.tizen.resourced"
      string "org.tizen.telephony"
      string ":1.72"
      string ":1.50"
      string ":1.51"
      string ":1.52"
      string ":1.30"
      string ":1.53"
      string ":1.31"
      string ":1.54"
      string ":1.10"
      string ":1.32"
      string ":1.55"
      string ":1.11"
      string ":1.33"
      string ":1.12"
      string ":1.34"
      string ":1.57"
      string "org.tizen.system.deviced"
      string ":1.0"
      string ":1.13"
      string ":1.35"
      string ":1.1"
      string ":1.14"
      string ":1.36"
      string ":1.59"
      string ":1.2"
      string ":1.15"
      string ":1.37"
      string ":1.3"
      string ":1.16"
      string ":1.38"
      string "org.tizen.NetNfcService"
      string ":1.4"
      string ":1.17"
      string ":1.39"
      string "ALARM.apush"
      string ":1.5"
      string ":1.18"
      string ":1.19"
   ]

To print all the interfaces in a service,

gdbus introspect -r --system -o / -d {service_name}

for example, 

gdbus introspect -r --system -o / -d org.tizen.system.deviced

prints this on same emulator.

 

node / {
  node /Org {
    node /Org/Tizen {
      node /Org/Tizen/System {
        node /Org/Tizen/System/DeviceD {
          node /Org/Tizen/System/DeviceD/Apps {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Apps {
              methods:
                LowBatteryDisable(out i arg_0);
                LowBatteryEnable(out i arg_0);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Battery {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Battery {
              methods:
                ChargerStatus(out i arg_0);
                ChargeNow(out i arg_0);
                BatteryStatusLow(out i arg_0);
                GetPercent(out i arg_0);
                GetPercentRaw(out i arg_0);
                IsFull(out i arg_0);
                GetHealth(out i arg_0);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Board {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Board {
              methods:
                GetSerial(out s arg_0,
                          out i arg_1);
                GetHWRev(out i arg_0);
                GetNum(out s arg_0,
                       out i arg_1);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Core {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.core {
              methods:
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Cpu {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Cpu {
              methods:
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Display {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.display {
              methods:
                start();
                stop();
                lockstate(in  s arg_0,
                          in  s arg_1,
                          in  s arg_2,
                          in  i arg_3,
                          out i arg_4);
                unlockstate(in  s arg_0,
                            in  s arg_1,
                            out i arg_2);
                changestate(in  s arg_0,
                            out i arg_1);
                getbrightness(out i arg_0);
                setbrightness(in  i arg_0,
                              out i arg_1);
                getautotone(out i arg_0);
                setautotone(in  i arg_0,
                            out i arg_1);
                setframerate(in  i arg_0,
                             in  i arg_1,
                             out i arg_2);
                getcolorblind(out i arg_0);
                setcolorblind(in  u arg_0,
                              in  t arg_1,
                              in  t arg_2,
                              in  t arg_3,
                              out i arg_4);
                setautobrightnessmin(in  i arg_0,
                                     out i arg_1);
                setlcdtimeout(in  i arg_0,
                              in  i arg_1,
                              in  i arg_2,
                              out i arg_3);
                LockScreenBgOn(in  s arg_0,
                               out i arg_1);
                GetDisplayCount(out i arg_0);
                GetMaxBrightness(out i arg_0);
                SetMaxBrightness(in  i arg_0,
                                 out i arg_1);
                GetBrightness(out i arg_0);
                SetBrightness(in  i arg_0,
                              out i arg_1);
                HoldBrightness(in  i arg_0,
                               out i arg_1);
                ReleaseBrightness(out i arg_0);
                GetAclStatus(out i arg_0);
                SetAclStatus(out i arg_0);
                GetAutoTone(out i arg_0);
                SetAutoTone(in  i arg_0,
                            out i arg_1);
                SetAutoToneForce(in  i arg_0,
                                 out i arg_1);
                SetRefreshRate(in  i arg_0,
                               in  i arg_1,
                               out i arg_2);
                GetColorBlind(out i arg_0);
                SetColorBlind(in  u arg_0,
                              in  t arg_1,
                              in  t arg_2,
                              in  t arg_3,
                              out i arg_4);
                GetHBM(out i arg_0);
                SetHBM(in  i arg_0,
                       out i arg_1);
                SetHBMTimeout(in  i arg_0,
                              in  i arg_1,
                              out i arg_2);
                Dumpmode(in  s arg_0,
                         out i arg_1);
                SaveLog();
                PowerKeyIgnore(in  i arg_0);
                PowerKeyLCDOff(out i arg_0);
                CustomLCDOn(in  i arg_0,
                            out i arg_1);
                StayTouchScreenOff(in  i arg_0,
                                   out i arg_1);
                LCDPanelOffMode(in  i arg_0,
                                out i arg_1);
                ActorControl(in  s arg_0,
                             in  i arg_1,
                             in  i arg_2,
                             out i arg_3);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/ExtCon {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.ExtCon {
              methods:
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Gpio {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Gpio {
              methods:
                GetStatus(in  s arg_0,
                          out i arg_1);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Hall {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.hall {
              methods:
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Haptic {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.haptic {
              methods:
                GetCount(out i arg_0);
                OpenDevice(in  i arg_0,
                           out i arg_1);
                CloseDevice(in  u arg_0,
                            out i arg_1);
                StopDevice(in  u arg_0,
                           out i arg_1);
                VibrateMonotone(in  u arg_0,
                                in  i arg_1,
                                in  i arg_2,
                                in  i arg_3,
                                out i arg_4);
                VibrateBuffer(in  u arg_0,
                              in  ay arg_1,
                              in  i arg_2,
                              in  i arg_3,
                              in  i arg_4,
                              out i arg_5);
                GetState(in  i arg_0,
                         out i arg_1);
                GetDuration(in  u arg_0,
                            in  ay arg_1,
                            out i arg_2);
                CreateEffect(in  i arg_0,
                             in  ay arg_1,
                             in  i arg_2,
                             out ay arg_3,
                             out i arg_4);
                SaveBinary(in  ay arg_0,
                           in  s arg_1,
                           out i arg_2);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/HdmiCec {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.HdmiCec {
              methods:
                GetState(out i arg_0);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Key {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Key {
              methods:
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Led {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Led {
              methods:
                SetIrCommand(in  s arg_0,
                             out i arg_1);
                GetBrightness(out i arg_0);
                GetMaxBrightness(out i arg_0);
                SetBrightness(in  i arg_0,
                              in  i arg_1,
                              out i arg_2);
                GetCameraBrightness(out i arg_0);
                SetCameraBrightness(in  i arg_0,
                                    out i arg_1);
                PlayPattern(in  s arg_0,
                            in  i arg_1,
                            out i arg_2);
                StopPattern(out i arg_0);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Mmc {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Mmc {
              methods:
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Pass {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.pass {
              methods:
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/PmQos {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.PmQos {
              methods:
                AppLaunch(in  i arg_0,
                          out i arg_1);
                AppLaunchHome(in  i arg_0,
                              out i arg_1);
                BeautyShot(in  i arg_0,
                           out i arg_1);
                Browser(in  i arg_0,
                        out i arg_1);
                BrowserDash(in  i arg_0,
                            out i arg_1);
                BrowserJavaScript(in  i arg_0,
                                  out i arg_1);
                BrowserLoading(in  i arg_0,
                               out i arg_1);
                BrowserScroll(in  i arg_0,
                              out i arg_1);
                CallSound(in  i arg_0,
                          out i arg_1);
                CameraBurstShot(in  i arg_0,
                                out i arg_1);
                CameraCaptureAtRec(in  i arg_0,
                                   out i arg_1);
                CameraPreview(in  i arg_0,
                              out i arg_1);
                CameraSoundAndShot(in  i arg_0,
                                   out i arg_1);
                ContactSearch(in  i arg_0,
                              out i arg_1);
                Emergency(in  i arg_0,
                          out i arg_1);
                GalleryScroll(in  i arg_0,
                              out i arg_1);
                GalleryRotation(in  i arg_0,
                                out i arg_1);
                GetDefaultLockTime(out i arg_0);
                GpsSerialCno(in  i arg_0,
                             out i arg_1);
                GpuBoost(in  i arg_0,
                         out i arg_1);
                GpuWakeup(in  i arg_0,
                          out i arg_1);
                HomeScreen(in  i arg_0,
                           out i arg_1);
                ImageViewer(in  i arg_0,
                            out i arg_1);
                IMEInput(in  i arg_0,
                         out i arg_1);
                LockScreen(in  i arg_0,
                           out i arg_1);
                LowBattery(in  i arg_0,
                           out i arg_1);
                MtpSendFile(in  i arg_0,
                            out i arg_1);
                MusicPlayLcdOn(in  i arg_0,
                               out i arg_1);
                PowerSaving(in  i arg_0,
                            out i arg_1);
                ProcessCrashed(in  i arg_0,
                               out i arg_1);
                ReservedMode(in  i arg_0,
                             out i arg_1);
                ScreenMirroring(in  i arg_0,
                                out i arg_1);
                SmemoZoom(in  i arg_0,
                          out i arg_1);
                SVoice(in  i arg_0,
                       out i arg_1);
                WebappLaunch(in  i arg_0,
                             out i arg_1);
                WifiThroughput(in  i arg_0,
                               in  i arg_1,
                               out i arg_2);
                PowerOff(in  i arg_0,
                         out i arg_1);
                WebAppDrag(in  i arg_0,
                           out i arg_1);
                WebAppFlick(in  i arg_0,
                            out i arg_1);
                SensorWakeup(in  i arg_0,
                             out i arg_1);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Power {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.power {
              methods:
                setresetkeydisable(in  i arg_0,
                                   out i arg_1);
                SetWakeupKey(in  i arg_0,
                             out i arg_1);
                reboot(in  s arg_0,
                       in  i arg_1,
                       out i arg_2);
                pwroff-popup(in  s arg_0,
                             in  i arg_1,
                             out i arg_2);
                Reboot(in  s arg_0,
                       out i arg_1);
                flightmode(in  s arg_0,
                           in  i arg_1,
                           in  s arg_2,
                           out i arg_3);
                entersleep(in  s arg_0,
                           in  i arg_1,
                           out i arg_2);
                leavesleep(in  s arg_0,
                           in  i arg_1,
                           out i arg_2);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Process {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Process {
              methods:
                foregrd(in  s arg_0,
                        in  i arg_1,
                        in  s arg_2,
                        out i arg_3);
                backgrd(in  s arg_0,
                        in  i arg_1,
                        in  s arg_2,
                        out i arg_3);
                active(in  s arg_0,
                       in  i arg_1,
                       in  s arg_2,
                       out i arg_3);
                inactive(in  s arg_0,
                         in  i arg_1,
                         in  s arg_2,
                         out i arg_3);
                oomadj_set(in  s arg_0,
                           in  i arg_1,
                           in  s arg_2,
                           in  s arg_3,
                           out i arg_4);
                process_group_set(in  s arg_0,
                                  in  i arg_1,
                                  in  s arg_2,
                                  in  s arg_3,
                                  out i arg_4);
                GetSiopLevel(out i arg_0);
                GetRearLevel(out i arg_0);
                SetSiopLevel(in  s arg_0,
                             in  s arg_1,
                             out i arg_2);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Storage {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.storage {
              methods:
                getstorage(out i arg_0);
                MemTrim(out i arg_0);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/SysNoti {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.SysNoti {
              methods:
                device_changed(in  s arg_0,
                               in  i arg_1,
                               in  s arg_2,
                               in  s arg_3,
                               out i arg_4);
                power_supply(in  s arg_0,
                             in  i arg_1,
                             in  s arg_2,
                             in  s arg_3,
                             in  s arg_4,
                             in  s arg_5,
                             in  s arg_6,
                             out i arg_7);
                kernel(in  s arg_0,
                       in  i arg_1,
                       in  s arg_2,
                       out i arg_3);
                GetHDCP(out i arg_0);
                GetHDMIAudio(out i arg_0);
                GetHDMI(out i arg_0);
                GetCradle(out i arg_0);
                factorymode(in  s arg_0,
                            in  i arg_1,
                            in  s arg_2,
                            out i arg_3);
                getstatus(out i arg_0);
                GetRevision(out i arg_0);
                set_datetime(in  s arg_0,
                             in  i arg_1,
                             in  s arg_2,
                             out i arg_3);
                set_timezone(in  s arg_0,
                             in  i arg_1,
                             in  s arg_2,
                             out i arg_3);
                GetCoolDownStatus(out s arg_0);
                CoolDownChanged(in  s arg_0,
                                in  i arg_1,
                                in  s arg_2,
                                in  s arg_3,
                                out i arg_4);
                control(in  s arg_0,
                        in  i arg_1,
                        in  s arg_2,
                        in  s arg_3,
                        in  s arg_4,
                        out i arg_5);
                getcontrol(in  s arg_0,
                           in  i arg_1,
                           in  s arg_2,
                           in  s arg_3,
                           out i arg_4);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Testmode {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Testmode {
              methods:
                Launch(in  s arg_0,
                       out i arg_1);
                factory15(in  s arg_0,
                          out i arg_1);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Usb {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Usb {
              methods:
                GetState(out u arg_0);
                GetMode(out u arg_0);
              signals:
              properties:
            };
          };
          node /Org/Tizen/System/DeviceD/Usbhost {
            interface org.freedesktop.DBus.Introspectable {
              methods:
                Introspect(out s arg_0);
              signals:
              properties:
            };
            interface org.tizen.system.deviced.Usbhost {
              methods:
              signals:
              properties:
            };
          };
        };
      };
    };
  };
};

to call a method

dbus-send --system --print-reply --reply-timeout=2000 --type=method_call --dest={service_name} {node_path} {interface_name}.{method_name} foreach_in_method_param: {param_type(string|int|...)}:{param_value}

to call that GetOutput method for example, 

dbus-send --system --print-reply --reply-timeout=2000  --type=method_call --dest=org.tizen.system.deviced /Org/Tizen/System/DeviceD/Board org.tizen.system.deviced.Board.GetSerial

and it prints

method return sender=:1.2 -> dest=:1.860 reply_serial=2
   string ""
   int32 -1

on the same emulator. I invoked this as root, developer and app users. All same result, so it actually allowing app user to call it on emulator. Not sure how it behaves on actual device tho. Can't test right now.

James B

Thank you Onur, it works !!!

sh-3.2$ dbus-send --system --print-reply --reply-timeout=2000  --type=method_call --dest=org.tizen.system.deviced /Org/Tizen/System/DeviceD/Board org.tizen.system.deviced.Board.GetSerial
method return sender=:1.3 -> dest=:1.220 reply_serial=2
   string "R3AH800L9XX"
   int32 0

Now all I need to do is to make the same dbus call from the native app and see if it can get the same output!

Onur Şahin

API is rather complex, you have to compare to a popen() call, so maybe try popen() first to see if you can invoke and get the same result from the app than go for api http://www.matthew.ath.cx/misc/dbus

James B

Yes, good suggestion. I know the bare dbus API is quite complex. I used it a couple of years ago to access bluez services; not exactly the experience I want to remember :)

 

I have now tested with popen and confirms that it works (as far as security is concerned), so now it's up to me to implement the dbus API call. Or perhaps I just keep the popen since I only need to get this value exactly once.

 

I'm marking  your answer as the correct solution, although obvious Peter Wegner has a lot to contribute to this thread too.

 

Thank you both.

 

PS: Peter - it would be good to confirm if Onur's solution works on the mobile Tizen as well?

 

 

 

Onur Şahin

"Or perhaps I just keep the popen since I only need to get this value exactly once."

That makes me wonder if popen is in whitelisted api calls, let me know if it get pass the review process if you publish it with popen.

On second thought even dbus api might be not allowed.

James B

Oh **!@#$%$%^&**. One of the post in the the first two pages is exactly that problem, somebody uploaded an app to the store, and got rejected because of the "whitelist". Why don't they just run the user apps in a SECCOMP-BPF and just crash it if it violates the constraint ... (on the second thought, we probabaly shouldn't give them more ideas to lock ourselves out).

Do you have any idea where I can get this "whitelist"? I can also try to upload to the store and see how it goes. I won't be able to publish it yet though, because it's unfinished; I'd probably go through "beta testing" process. Do they scan and review the app released in "beta test" mode?

Onur Şahin

They should give you a text file contains whitelisted api calls your app making if they reject it for a restricted call.Don't think there is a general list for all calls. Not sure about beta test.

James B

So they don't have a definite general list of allowed calls, but decide that "on-the-spot"?

Without any definite list it's difficult to say whether today's allowed API is still allowed tomorrow isn't it? :(

Way to go Samsung :( :(

I'll add the dbus api call in my app then I'll go through the beta-test submission process. We'll see. I'll get back when I have results.

James B

Bare dbus call can't be made. The header is there but the library isn't there. I will have to use libedbus, apparently.
 

James B

libedbus is for e18. My platform has e17, which has e_dbus (not edbus, nice naming EFL guys! not). Supposedly it supports gdbus as well, but when I plugged the file I generated from gdbus-codegen, compilation chokes because it can't find G_ADD_PRIVATE. Nice. NOT :(

Oh well, we'll persevere.

James B

Hahaha ... Looking into E_dbus.h, I see that almost all of the functions are commented out.

They aren't making this easy are they. Cross-compiling, here we come!

James B

Ok, I have the version that uses libdbus working. This is now truly solved. I will deal with "whitelisting" later as needed.

Peter Wegner

Cool.

 

Thanx for research and feedback.

 

Meanwhile I did some other "tests".. maybe this lead to something "usefull"...

 

1.

My SM-Z130H... Tizen 2.4.0.3... spit out few Pics with Bar Code + IMEI 1+ IMEI 2 + SN

 

If I enter this old Code for IMEI:

*#06#

 

Here I can see now Serial N. in human readable text string...

 

This feature is not since first Firmware... it comes after Tizen 2.4.forgotten which Version exactly...

Maybe not in first Beta 2.4.0.0

Maybe since 2.4.0.2...

 

2.

SM-Z200F for instance... spit out the DUID like we know...

This thingie from:

sdb shell /opt/etc/duid-gadget

If you go to Developer options...

 

No idea, feature since Tizen 2.4.0.4...

 

I have no idea, if it is possible to enter *#06# on Gear S3... and what Gear S3 spit out...

 

?

 

Best Regards

 

 

Onur Şahin

In Gear S3, tapping 5 times to the software version in settings brings up a code dialer which can be used to enter service codes like *#0# or *#06# etc.

 

*#06# Brings up a menu with only "SN" option on my bluetooth only gear s3. Clicking SN, shows the serial clear text and as a QR code.

 

Onur Şahin

Just checked, dialing codes on regular dialer also works.

Peter Wegner

Thank you very much Onur Şahin.

Nice and usefull infos.

 

James B.

I can confirm this "Command":

dbus-send --system --print-reply --reply-timeout=2000  --type=method_call --dest=org.tizen.system.deviced /Org/Tizen/System/DeviceD/Board org.tizen.system.deviced.Board.GetSerial

Success with my SM-Z130H with Tizen 2.4.0.3 Firmware.

 

Btw.

I hope your SN is "example value"...

Otherwise maybe now on Blacklist...

:)

Sorry, joke.

But better not spread such infos on Internet... I am paranoid.

 

If SN is really DUID for store activities... then bad guys could now have the same apps like you have on your Gear S3...

 

Be carefully.

 

Best Regards

James B

Thanks Peter for confirming.

Thanks for the warning - The SN I posted is just an example, not the real one (of course).