maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Looking for unique device identification id/string on n900 (https://talk.maemo.org/showthread.php?t=34058)

code177 2009-11-06 20:59

Looking for unique device identification id/string on n900
 
Hello, hello.

Something that may be useful to other app developers, especially if tying in mobile apps to web apps and vice versa -

I feel like there is an easily accessible Unique ID string for every device, like a mac address.

Does this exist? If so, any ideas how to access it? (bonus points if it's in python)

qwerty12 2009-11-06 21:05

Re: Looking for unique device identification id/string on n900
 
The IMEI number of the device can be retrieved:
dbus-send --system --print-reply --type=method_call --dest=com.nokia.phone.SIM /com/nokia/phone/SIM/security Phone.Sim.Security.get_imei

(Sorry, no Python example; I don't know python-dbus and my dbus-glib knowledge is quite bad anyway...)

Two things returned (in this order):
* IMEI as a string
* An int32 (which says 0 here)

daperl 2009-11-06 21:25

Re: Looking for unique device identification id/string on n900
 
An n8x0 Python hack to get MAC address:

Code:

import os

for line in os.popen('/sbin/ifconfig'):
    if line.find('wlan0') > -1:
        mac = line.split()[4]
        print mac


Fargus 2009-11-06 21:33

Re: Looking for unique device identification id/string on n900
 
Quote:

Originally Posted by daperl (Post 367773)
An n8x0 Python hack to get MAC address:

Code:

import os

for line in os.popen('/sbin/ifconfig'):
    if line.find('wlan0') > -1:
        mac = line.split()[4]
        print mac


Nice idea but MAC can be easily spoofed. IMEI is legally not supposed to be changed as I believe it's programmed in at low level. This is also the number used to bar handsets reported as stolen from networks. Should therefore work as unique number for any device.

Kieron 2009-11-06 21:44

Re: Looking for unique device identification id/string on n900
 
Could one not install something like macchanger to spoof or get mac? I've used such a thing on Ubuntu a few years back when messing with WEP cracking.

daperl 2009-11-06 21:47

Re: Looking for unique device identification id/string on n900
 
Quote:

Originally Posted by Fargus (Post 367784)
Should therefore work as unique number for any GSM device.

..........

fragos 2009-11-06 22:23

Re: Looking for unique device identification id/string on n900
 
Linux uses vendor:device hex codes as in 046d:c03f for my Logitech mouse. Udev uses these to identify devices as well in /lib/udev/rules.d. Here's an example of rule file 50-video.rules which I created to set special mount points for video devices.

KERNEL=="video*", SYSFS{vendor}=="0x4444", SYSFS{device}=="0x0016", SYSFS{name}=="ivtv0 encoder MPEG", SYMLINK+="video/pvr150"
KERNEL=="video*", SYSFS{vendor}=="0x109e", SYSFS{device}=="0x036e", SYMLINK+="video/bttv"
KERNEL=="video*", SYSFS{vendor}=="0x046d", SYSFS{device}=="0x092e", SYMLINK+="video/webcam"

Hopefully this will give you some hints on where to look as it relates to Nokia tablets.

fragos 2009-11-06 22:25

Re: Looking for unique device identification id/string on n900
 
Linux uses vendor:device hex codes as in 046d:c03f for my Logitech mouse. Udev uses these to identify devices as well in /lib/udev/rules.d. Here's an example of rule file 50-video.rules which I created to set special mount points for video devices.

KERNEL=="video*", SYSFS{vendor}=="0x4444", SYSFS{device}=="0x0016", SYSFS{name}=="ivtv0 encoder MPEG", SYMLINK+="video/pvr150"
KERNEL=="video*", SYSFS{vendor}=="0x109e", SYSFS{device}=="0x036e", SYMLINK+="video/bttv"
KERNEL=="video*", SYSFS{vendor}=="0x046d", SYSFS{device}=="0x092e", SYMLINK+="video/webcam"

Hopefully this will give you some hints on where to look as it relates to Nokia tablets. Note that will identify the device as in vendor and model and isn't like a mac address which identifies a port on the network.

daperl 2009-11-06 22:48

Re: Looking for unique device identification id/string on n900
 
Quote:

Originally Posted by fragos (Post 367815)
Linux uses vendor:device hex codes as in 046d:c03f for my Logitech mouse. Udev uses these to identify devices as well in /lib/udev/rules.d. Here's an example of rule file 50-video.rules which I created to set special mount points for video devices.

KERNEL=="video*", SYSFS{vendor}=="0x4444", SYSFS{device}=="0x0016", SYSFS{name}=="ivtv0 encoder MPEG", SYMLINK+="video/pvr150"
KERNEL=="video*", SYSFS{vendor}=="0x109e", SYSFS{device}=="0x036e", SYMLINK+="video/bttv"
KERNEL=="video*", SYSFS{vendor}=="0x046d", SYSFS{device}=="0x092e", SYMLINK+="video/webcam"

Hopefully this will give you some hints on where to look as it relates to Nokia tablets. Note that will identify the device as in vendor and model and isn't like a mac address which identifies a port on the network.

I think the vendor/device code is only suppose to be unique per product, not per physical instantiation of a product. For instance, when plugged into a PC, all n800's should export the same USB vendor/device ID, but every n800 should have its own unique default wlan MAC address.

andree 2009-11-06 23:32

Re: Looking for unique device identification id/string on n900
 
Quote:

Originally Posted by Kieron (Post 367791)
Could one not install something like macchanger to spoof or get mac? I've used such a thing on Ubuntu a few years back when messing with WEP cracking.

even simpler -

ip link set wlan0 address 11:22:33:44:55:66

...but one has to have ip tools installed, which I didn't find last time I tried n900 with RDA... :-/ and the device driver has to support this functionality, of course :)


All times are GMT. The time now is 02:23.

vBulletin® Version 3.8.8