How to link a device to udev?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have a microcontroller with a few "strange" devices.



One of these is an embedded Ethernet switch.



Cable connections and disconnections are captured by driver which dutifully prints a log message:



[ 260.740000] rt305x-esw 10110000.esw: link changed 0x01
[ 2542.440000] rt305x-esw 10110000.esw: link changed 0x00
[ 2544.390000] rt305x-esw 10110000.esw: link changed 0x01


The driver also registers in sysfs:



# ls -l /sys/devices/10110000.esw/
total 0
lrwxrwxrwx 1 root root 0 Jan 1 01:05 driver -> ../../bus/platform/drivers/rt305x-esw
-rw-r--r-- 1 root root 4096 Jan 1 01:05 driver_override
-r--r--r-- 1 root root 4096 Jan 1 01:05 modalias
lrwxrwxrwx 1 root root 0 Jan 1 01:05 subsystem -> ../../bus/platform
-rw-r--r-- 1 root root 4096 Jan 1 01:00 uevent


but its uevent is rather cryptic to me:



# cat /sys/devices/10110000.esw/uevent 
DRIVER=rt305x-esw
OF_NAME=esw
OF_FULLNAME=/esw@10110000
OF_COMPATIBLE_0=ralink,rt3050-esw
OF_COMPATIBLE_N=1
MODALIAS=of:NeswT<NULL>Cralink,rt3050-esw


Now the question:



I should connect a uevent rule to "link changed" events; how can I do that?



I was unable to find any (relevant) documentation; can someone point me in the right direction, please?







share|improve this question




















  • First see if the driver is sending out a event to udev when the status change. Do sudo udevadm monitor -k -p to print the events as they occur.
    – meuh
    Oct 15 '17 at 15:07














up vote
0
down vote

favorite












I have a microcontroller with a few "strange" devices.



One of these is an embedded Ethernet switch.



Cable connections and disconnections are captured by driver which dutifully prints a log message:



[ 260.740000] rt305x-esw 10110000.esw: link changed 0x01
[ 2542.440000] rt305x-esw 10110000.esw: link changed 0x00
[ 2544.390000] rt305x-esw 10110000.esw: link changed 0x01


The driver also registers in sysfs:



# ls -l /sys/devices/10110000.esw/
total 0
lrwxrwxrwx 1 root root 0 Jan 1 01:05 driver -> ../../bus/platform/drivers/rt305x-esw
-rw-r--r-- 1 root root 4096 Jan 1 01:05 driver_override
-r--r--r-- 1 root root 4096 Jan 1 01:05 modalias
lrwxrwxrwx 1 root root 0 Jan 1 01:05 subsystem -> ../../bus/platform
-rw-r--r-- 1 root root 4096 Jan 1 01:00 uevent


but its uevent is rather cryptic to me:



# cat /sys/devices/10110000.esw/uevent 
DRIVER=rt305x-esw
OF_NAME=esw
OF_FULLNAME=/esw@10110000
OF_COMPATIBLE_0=ralink,rt3050-esw
OF_COMPATIBLE_N=1
MODALIAS=of:NeswT<NULL>Cralink,rt3050-esw


Now the question:



I should connect a uevent rule to "link changed" events; how can I do that?



I was unable to find any (relevant) documentation; can someone point me in the right direction, please?







share|improve this question




















  • First see if the driver is sending out a event to udev when the status change. Do sudo udevadm monitor -k -p to print the events as they occur.
    – meuh
    Oct 15 '17 at 15:07












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a microcontroller with a few "strange" devices.



One of these is an embedded Ethernet switch.



Cable connections and disconnections are captured by driver which dutifully prints a log message:



[ 260.740000] rt305x-esw 10110000.esw: link changed 0x01
[ 2542.440000] rt305x-esw 10110000.esw: link changed 0x00
[ 2544.390000] rt305x-esw 10110000.esw: link changed 0x01


The driver also registers in sysfs:



# ls -l /sys/devices/10110000.esw/
total 0
lrwxrwxrwx 1 root root 0 Jan 1 01:05 driver -> ../../bus/platform/drivers/rt305x-esw
-rw-r--r-- 1 root root 4096 Jan 1 01:05 driver_override
-r--r--r-- 1 root root 4096 Jan 1 01:05 modalias
lrwxrwxrwx 1 root root 0 Jan 1 01:05 subsystem -> ../../bus/platform
-rw-r--r-- 1 root root 4096 Jan 1 01:00 uevent


but its uevent is rather cryptic to me:



# cat /sys/devices/10110000.esw/uevent 
DRIVER=rt305x-esw
OF_NAME=esw
OF_FULLNAME=/esw@10110000
OF_COMPATIBLE_0=ralink,rt3050-esw
OF_COMPATIBLE_N=1
MODALIAS=of:NeswT<NULL>Cralink,rt3050-esw


Now the question:



I should connect a uevent rule to "link changed" events; how can I do that?



I was unable to find any (relevant) documentation; can someone point me in the right direction, please?







share|improve this question












I have a microcontroller with a few "strange" devices.



One of these is an embedded Ethernet switch.



Cable connections and disconnections are captured by driver which dutifully prints a log message:



[ 260.740000] rt305x-esw 10110000.esw: link changed 0x01
[ 2542.440000] rt305x-esw 10110000.esw: link changed 0x00
[ 2544.390000] rt305x-esw 10110000.esw: link changed 0x01


The driver also registers in sysfs:



# ls -l /sys/devices/10110000.esw/
total 0
lrwxrwxrwx 1 root root 0 Jan 1 01:05 driver -> ../../bus/platform/drivers/rt305x-esw
-rw-r--r-- 1 root root 4096 Jan 1 01:05 driver_override
-r--r--r-- 1 root root 4096 Jan 1 01:05 modalias
lrwxrwxrwx 1 root root 0 Jan 1 01:05 subsystem -> ../../bus/platform
-rw-r--r-- 1 root root 4096 Jan 1 01:00 uevent


but its uevent is rather cryptic to me:



# cat /sys/devices/10110000.esw/uevent 
DRIVER=rt305x-esw
OF_NAME=esw
OF_FULLNAME=/esw@10110000
OF_COMPATIBLE_0=ralink,rt3050-esw
OF_COMPATIBLE_N=1
MODALIAS=of:NeswT<NULL>Cralink,rt3050-esw


Now the question:



I should connect a uevent rule to "link changed" events; how can I do that?



I was unable to find any (relevant) documentation; can someone point me in the right direction, please?









share|improve this question











share|improve this question




share|improve this question










asked Oct 14 '17 at 17:06









ZioByte

17117




17117











  • First see if the driver is sending out a event to udev when the status change. Do sudo udevadm monitor -k -p to print the events as they occur.
    – meuh
    Oct 15 '17 at 15:07
















  • First see if the driver is sending out a event to udev when the status change. Do sudo udevadm monitor -k -p to print the events as they occur.
    – meuh
    Oct 15 '17 at 15:07















First see if the driver is sending out a event to udev when the status change. Do sudo udevadm monitor -k -p to print the events as they occur.
– meuh
Oct 15 '17 at 15:07




First see if the driver is sending out a event to udev when the status change. Do sudo udevadm monitor -k -p to print the events as they occur.
– meuh
Oct 15 '17 at 15:07















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398136%2fhow-to-link-a-device-to-udev%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398136%2fhow-to-link-a-device-to-udev%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Christian Cage

How to properly install USB display driver for Fresco Logic FL2000DX on Ubuntu?