Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
problem creating apcupsd hiddev links
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
mjbjr
Apprentice
Apprentice


Joined: 02 Mar 2003
Posts: 233

PostPosted: Mon Dec 05, 2016 9:07 am    Post subject: problem creating apcupsd hiddev links Reply with quote

I'm running 4.4.26-gentoo.
.
*** I do NOT use 'systemd'. ***
.

I have two APC backup USB ups's that I need to monitor with apcupsd.
You do this by running two apcupsd instances with two separate config
files, each configured to work with a specific apcupsd.conf defined DEVICE.

UPS's use hiddev devices in /dev/usb.

I have those:

# ls -l /dev/usb
total 0
crw------- 1 root root 180, 96 Dec 4 23:48 hiddev0
crw------- 1 root root 180, 97 Dec 4 23:48 hiddev1
crw------- 1 root root 180, 98 Dec 4 23:48 hiddev2

While I work on this configuration problem my /etc/apcupsd/apcupsd.conf
file specifies just one device

DEVICE /dev/usb/hiddev0

which I know is my "main" APC ups.

'apcaccess status' confirms it is online and being monitored.

The problem is hiddev's are dynamic and you can't guarantee that one
will always be assigned to a particular device and in my case I now have
more than one and need the specific assigments.

So, like other hardware devices attached to the system you use udev
rules to assign names to specific devices. I don't have problems with
udev and frequently make rules that work properly.

Want you want is something like this:

$ ls -l /dev/usb

crw------- 1 root root 180, 96 Aug 30 10:41 hiddev0
crw------- 1 root root 180, 97 Aug 30 10:41 hiddev1
lrwxrwxrwx 1 root root 7 Aug 30 10:41 ups-network -> hiddev0
lrwxrwxrwx 1 root root 7 Aug 30 10:41 ups-server -> hiddev1

And then you have two different apcupsd.conf files...

one specifies

DEVICE /dev/usb/ups-network

the other specifies

DEVICE /dev/usb/ups-server

My problem is that I have been unable to craft a udev rule that creates
those links to those hiddev's.

I've spent a fair bit of time researching this assignment problem on
the net and have only found one that seems to answer my problem, only
I can't get the rule to create the proper link in my case.

I've been following these documents:

http://www.apcupsd.com/manual/manual.html#verifying-device-detection-and-driver
https://wiki.debian.org/apcupsd#Configuring_.28Multiple_UPS_Devices.29

which show

KERNEL=="hiddev*", ATTRS{manufacturer}=="American Power Conversion", ATTRS{serial}=="AS0000000001", OWNER="root", SYMLINK+="usb/ups-network"

which results in this link being created in /dev/usb:

lrwxrwxrwx 1 root root 7 Aug 30 10:41 ups-network -> hiddev0

This rule of mine:

KERNEL=="hiddev*", ATTR{manufacturer}=="American Power Conversion", ATTR{product}=="Smart-UPS 750 RM FW:619.3.D USB FW:1.5", ATTR{serial}=="AS0307777777", OWNER="root", SYMLINK+="usb/apc_main"

creates no link.

This rule:

KERNEL=="2-1.1", ATTR{manufacturer}=="American Power Conversion", ATTR{product}=="Smart-UPS 750 RM FW:619.3.D USB FW:1.5", ATTR{serial}=="AS0307777777", OWNER="root", SYMLINK+="usb/apc_main"

creates:

lrwxrwxrwx 1 root root 18 Dec 5 00:43 apc_main -> ../bus/usb/002/014

Unfortunately, afaict, apcupsd will only work with links directly to a hiddev.

This rule:

SUBSYSTEM=="usb", ATTR{manufacturer}=="American Power Conversion", ATTR{product}=="Smart-UPS 750 RM FW:619.3.D USB FW:1.5", ATTR{serial}=="AS0307777777", SYMLINK+="usb/apc_main"

creates

lrwxrwxrwx 1 root root 18 Dec 5 00:59 apc_main -> ../bus/usb/002/014

Again, apcupsd won't recognize this type of link.

Any ideas?

Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum