Subject: uhid and UPS's
To: None <tech-userlevel@netbsd.org>
From: Wolfgang S. Rupprecht <wolfgang+gnus20041115T103227@dailyplanet.dontspam.wsrcc.com>
List: tech-userlevel
Date: 11/15/2004 11:38:04
[ I flipped a coin and decided this was more userland-ish than
kernel-ish. -wsr ]

I just got a new UPS (APC br1500 back-ups rs 1500va).  It talks usb as
a uhid, but not in a way that the kernel can deal with.  The apcupsd
instructions say to comment out all uhid's and uhidev's in the
kernel's config file and then talk to the UPS over a ugen driver.
This is somewhat drastic.

The main sticking point appears to be that in netbsd's uhidev,
different USB report-id's create and get dispatched to their own
uhid%d.  Unfortunately, the UPS uses a different report id for each of
the 56 status values it reports.  I end up with 56 uhid's in all.  To
monitor all the ups's vitals, it appears that I'd need to open one fd
for each of uhid0 to uhid55 and monitor them all.  Am I
misunderstanding things?  Is there some way to tell uhid/uhidev to
send me all the status reports on a single fd?  (Do I just need to
hack uhidev.c to never create multiple uhids for power control
devices?)

-wolfgang

Nov 12 20:24:20 scoville /netbsd: NetBSD 2.99.10 (WSRCC_INTEL) #1: Sun Nov  7 13:38:57 PST 2004

...

Nov 12 20:24:20 scoville /netbsd: uhidev0: American Power Conversion Back-UPS RS 1500 FW:8.g8 .D USB FW:g8, rev 1.10/1.06, addr 2, iclass 3/0
Nov 12 20:24:20 scoville /netbsd: sd0 at scsibus0 target 1 lun 0: <IBM, DCAS-34330W, S61A> disk fixed
Nov 12 20:24:20 scoville /netbsd: uhidev0: 123 report ids
Nov 12 20:24:20 scoville /netbsd: uhid0 at uhidev0 reportid 1: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid1 at uhidev0 reportid 2: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid2 at uhidev0 reportid 3: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid3 at uhidev0 reportid 4: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid4 at uhidev0 reportid 5: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid5 at uhidev0 reportid 6: input=3, output=0, feature=3
Nov 12 20:24:20 scoville /netbsd: uhid6 at uhidev0 reportid 7: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid7 at uhidev0 reportid 8: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid8 at uhidev0 reportid 9: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid9 at uhidev0 reportid 10: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid10 at uhidev0 reportid 11: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid11 at uhidev0 reportid 12: input=3, output=0, feature=3
Nov 12 20:24:20 scoville /netbsd: uhid12 at uhidev0 reportid 13: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid13 at uhidev0 reportid 14: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid14 at uhidev0 reportid 15: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid15 at uhidev0 reportid 16: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid16 at uhidev0 reportid 17: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid17 at uhidev0 reportid 18: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid18 at uhidev0 reportid 19: input=1, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid19 at uhidev0 reportid 20: input=2, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid20 at uhidev0 reportid 21: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid21 at uhidev0 reportid 22: input=4, output=0, feature=4
Nov 12 20:24:20 scoville /netbsd: uhid22 at uhidev0 reportid 23: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid23 at uhidev0 reportid 24: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid24 at uhidev0 reportid 28: input=0, output=0, feature=3
Nov 12 20:24:20 scoville /netbsd: uhid25 at uhidev0 reportid 32: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid26 at uhidev0 reportid 33: input=1, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid27 at uhidev0 reportid 34: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid28 at uhidev0 reportid 35: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid29 at uhidev0 reportid 36: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid30 at uhidev0 reportid 37: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid31 at uhidev0 reportid 38: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid32 at uhidev0 reportid 39: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid33 at uhidev0 reportid 40: input=0, output=0, feature=4
Nov 12 20:24:20 scoville /netbsd: uhid34 at uhidev0 reportid 48: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid35 at uhidev0 reportid 49: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid36 at uhidev0 reportid 50: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid37 at uhidev0 reportid 51: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid38 at uhidev0 reportid 52: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid39 at uhidev0 reportid 53: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid40 at uhidev0 reportid 54: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid41 at uhidev0 reportid 64: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid42 at uhidev0 reportid 65: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid43 at uhidev0 reportid 66: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid44 at uhidev0 reportid 80: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid45 at uhidev0 reportid 81: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid46 at uhidev0 reportid 82: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid47 at uhidev0 reportid 96: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid48 at uhidev0 reportid 97: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid49 at uhidev0 reportid 98: input=0, output=0, feature=4
Nov 12 20:24:20 scoville /netbsd: uhid50 at uhidev0 reportid 116: input=0, output=0, feature=4
Nov 12 20:24:20 scoville /netbsd: uhid51 at uhidev0 reportid 117: input=0, output=0, feature=2
Nov 12 20:24:20 scoville /netbsd: uhid52 at uhidev0 reportid 120: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid53 at uhidev0 reportid 121: input=0, output=0, feature=1
Nov 12 20:24:20 scoville /netbsd: uhid54 at uhidev0 reportid 122: input=0, output=0, feature=4
Nov 12 20:24:20 scoville /netbsd: uhid55 at uhidev0 reportid 123: input=0, output=0, feature=2

-- 
Wolfgang S. Rupprecht                http://www.wsrcc.com/wolfgang/
	 When you talk to musicians about pirates they think
		   you are talking about the RIAA.