public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* Determining MAC address or Serial Number
@ 2009-10-30  9:40 Lou Otway
  2009-10-30 11:09 ` pierre.gronlier
  0 siblings, 1 reply; 3+ messages in thread
From: Lou Otway @ 2009-10-30  9:40 UTC (permalink / raw)
  To: linux-media

Hi,

I'm trying to find a way to be able to uniquely identify each device in 
a PC and was hoping to use either serial or MAC for this purpose.

I've looked at the documentation but can't find a generic way to read 
back serial numbers or MAC addresses from V4L devices? Does such a 
function exist?

Thanks,

Lou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Determining MAC address or Serial Number
  2009-10-30  9:40 Determining MAC address or Serial Number Lou Otway
@ 2009-10-30 11:09 ` pierre.gronlier
  2009-10-30 13:59   ` Lou Otway
  0 siblings, 1 reply; 3+ messages in thread
From: pierre.gronlier @ 2009-10-30 11:09 UTC (permalink / raw)
  To: linux-media

Lou Otway wrote, On 10/30/2009 10:40 AM:
> Hi,
> 
> I'm trying to find a way to be able to uniquely identify each device in
> a PC and was hoping to use either serial or MAC for this purpose.
> 
> I've looked at the documentation but can't find a generic way to read
> back serial numbers or MAC addresses from V4L devices? Does such a
> function exist?


Hi Lou,

I'm using the mac address to identify each device and to do so I created
this script which use dvbnet to create network interface from the dvb card.

a=<your adapter>
n=<your net device>
for ex. /dev/dvb/adapter1/net0 => a=1, n=0


# get mac address
iface=$(sudo /usr/bin/dvbnet -a $a -n $n -p 0 | awk '/device/ {print $3}')
sleep 1
mac_address=$(/sbin/ifconfig $iface | awk '/HWaddr/ {print $5}' | tr -d
':' | tr A-Z a-z)
num=$(sudo /usr/bin/dvbnet -a $a -n $n -l | grep 'Found device ' | awk
'{print $3}' | tr -d ':')
sleep 1
sudo /usr/bin/dvbnet -a $a -n $n -d $num 1> /dev/null



AFAIK, mac address are known only from the kernel and are not directly
exposed to the userland. I you manage to do something "cleaner", let me
know :)


Regards

pierre gr.

> 
> Thanks,
> 
> Lou



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Determining MAC address or Serial Number
  2009-10-30 11:09 ` pierre.gronlier
@ 2009-10-30 13:59   ` Lou Otway
  0 siblings, 0 replies; 3+ messages in thread
From: Lou Otway @ 2009-10-30 13:59 UTC (permalink / raw)
  To: pierre.gronlier; +Cc: linux-media

pierre.gronlier wrote:
> Lou Otway wrote, On 10/30/2009 10:40 AM:
>   
>> Hi,
>>
>> I'm trying to find a way to be able to uniquely identify each device in
>> a PC and was hoping to use either serial or MAC for this purpose.
>>
>> I've looked at the documentation but can't find a generic way to read
>> back serial numbers or MAC addresses from V4L devices? Does such a
>> function exist?
>>     
>
>
> Hi Lou,
>
> I'm using the mac address to identify each device and to do so I created
> this script which use dvbnet to create network interface from the dvb card.
>
> a=<your adapter>
> n=<your net device>
> for ex. /dev/dvb/adapter1/net0 => a=1, n=0
>
>
> # get mac address
> iface=$(sudo /usr/bin/dvbnet -a $a -n $n -p 0 | awk '/device/ {print $3}')
> sleep 1
> mac_address=$(/sbin/ifconfig $iface | awk '/HWaddr/ {print $5}' | tr -d
> ':' | tr A-Z a-z)
> num=$(sudo /usr/bin/dvbnet -a $a -n $n -l | grep 'Found device ' | awk
> '{print $3}' | tr -d ':')
> sleep 1
> sudo /usr/bin/dvbnet -a $a -n $n -d $num 1> /dev/null
>
>
>
> AFAIK, mac address are known only from the kernel and are not directly
> exposed to the userland. I you manage to do something "cleaner", let me
> know :)
>
>
> Regards
>
> pierre gr.
>
>
>   
> re majordomo info at  http://vger.kernel.org/majordomo-info.html
>   
Thanks Pierre,

Unfortunately only some of my devices reported a MAC address, I guess 
that not all drivers have this feature built in. I think the same 
problem will hold true for serial devices so I will look at another way 
to list my devices.

I was thinking to use lshw or lspci to give me a list of devices, from 
that I can build my own table of devices each one with a unique value to 
differentiate it from others. My worry is that the output from lshw or 
lspci isn't sufficiently detailed to allow me to differentiate between 
devices.

Thanks,

Lou








^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-30 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-30  9:40 Determining MAC address or Serial Number Lou Otway
2009-10-30 11:09 ` pierre.gronlier
2009-10-30 13:59   ` Lou Otway

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox