Re: sysutils/apcupsd with USB cable broken in latest snap

2016-06-08 Thread Johan Huldtgren

On 6/8/16 01:41, Kirill Bychkov wrote:

On Wed, June 8, 2016 03:33, Johan Huldtgren wrote:
[...]


ok, on the off chance that this was an amd64 vs i386 issue (unlikely but
figured it couldn't hurt to try) I installed the latest amd64 snap on a
different host and updated ports (I had apcupsd installed here in client
mode), attached the UPS and swapped the config file to the server one,
but alas the results are the same. Must be an issue with my UPS and the
new code I guess.


Just a guess but may be you need to use modbus driver instead of usb?


Using modbus via usb didn't work, however this model has both a usb
port and an rs232 serial port[1]. Using the rs232 port together with
the 940-0625A cable (rs232 <-> db9) and connecting to a serial port on
another server I can get apcupsd to work. So I have a work around,
that said it seems it no longer works with usb, I tried all
permutations I could imagine of physical cables, UPSCABLE, UPSTYPE,
and DEVICE; but if connected via USB (even if from the rs232 port via
a db9 <-> usb adapter) I never get apcupsd to communicate with the
UPS. I suspect the errors which could be seen yesterday in the apctest
and apcupsd -d output might be relevant but as I said then I'm not
sure how to deal with them.  apctest succeeds now and none of the
errors seen with the USB cable are evident when using a serial
connection.

thanks,

.jh

[1] https://media.cablesandkits.com/p/SMT2200RM2Uc.jpg



Re: sysutils/apcupsd with USB cable broken in latest snap

2016-06-07 Thread Kirill Bychkov
On Wed, June 8, 2016 03:33, Johan Huldtgren wrote:
[...]
>
> ok, on the off chance that this was an amd64 vs i386 issue (unlikely but
> figured it couldn't hurt to try) I installed the latest amd64 snap on a
> different host and updated ports (I had apcupsd installed here in client
> mode), attached the UPS and swapped the config file to the server one,
> but alas the results are the same. Must be an issue with my UPS and the
> new code I guess.

Just a guess but may be you need to use modbus driver instead of usb?

> On 6/7/16 08:12, Stuart Henderson wrote:
>>I am pretty sure you will have the broken behaviour with 3.4.14 on
>> the old kernel too, which would suggest that there's a problem with
>> apcupsd's generic usb code either on OpenBSD or in your configuration
>> (e.g. with your UPS etc).
>>
>> The easiest case would probably be if you can find someone who has
>> a working 3.4.14 on -current. If so, I'd install the same, obtain debug
>> logs and compare with theirs. If there's nothing obvious then maybe
>> ask upstream for suggestions.
>
> So I started poking around, and this might be relevant
>
> # apctest
> 2016-06-07 20:18:30 apctest 3.14.14 (31 May 2016) openbsd
> Checking configuration ...
> sharenet.type = Network & ShareUPS Disabled
> cable.type = USB Cable
> mode.type = USB UPS Driver
> Setting up the port ...
> apctest FATAL ERROR in apctest.c at line 321
> Unable to open UPS device.
>If apcupsd or apctest is already running,
>please stop it and run this program again.
> apctest error termination completed
>
> (it should be noted nothing was running at this time, I had just
> rebooted the host with apcupsd disabled)
>
> Further when setting the debug high and running it on the console I get
> this:
>
> # apcupsd -d 666
> 0.000 apcupsd: apcupsd.c:156 Options parsed.
> 0.001 apcupsd: apcconfig.c:755 After config scriptdir: "/etc/apcupsd"
> 0.001 apcupsd: apcconfig.c:756 After config pwrfailpath: "/etc/apcupsd"
> 0.001 apcupsd: apcconfig.c:757 After config nologinpath: "/etc"
> 0.001 apcupsd: apcupsd.c:179 Config file /etc/apcupsd/apcupsd.conf
> processed.
> 0.001 apcupsd: newups.c:102 write_lock at drivers.c:109
> 0.001 apcupsd: drivers.c:111 Looking for driver: usb
> 0.001 apcupsd: drivers.c:115 Driver dumb is configured.
> 0.001 apcupsd: drivers.c:115 Driver apcsmart is configured.
> 0.001 apcupsd: drivers.c:115 Driver net is configured.
> 0.001 apcupsd: drivers.c:115 Driver usb is configured.
> 0.002 apcupsd: drivers.c:118 Driver usb found and attached.
> 0.002 apcupsd: newups.c:108 write_unlock at drivers.c:135
> 0.002 apcupsd: drivers.c:137 Driver ptr=0xb223d800
> 0.002 apcupsd: drivers.c:138 Attached to driver: usb
> 0.012 apcupsd: apcupsd.c:251 NIS thread started.
> 0.013 apcupsd: apclog.c:62 apcupsd 3.14.14 (31 May 2016) openbsd startup
> succeeded
> 0.014 apcupsd: apclog.c:62 NIS server startup succeeded
> 0.023 apcupsd: newups.c:102 write_lock at generic-usb.c:457
> 0.023 apcupsd: HidUps.cpp:50 Initializing libusb
> 0.033 apcupsd: HidUps.cpp:55 Found 8 USB busses
> 0.045 apcupsd: HidUps.cpp:57 Found 9 USB devices
> 0.045 apcupsd: HidUps.cpp:68 000:001 - 8086:
> 0.045 apcupsd: HidUps.cpp:112 Not an APC device.
> 0.045 apcupsd: HidUps.cpp:68 001:001 - 8086:
> 0.045 apcupsd: HidUps.cpp:112 Not an APC device.
> 0.045 apcupsd: HidUps.cpp:68 002:001 - 8086:
> 0.045 apcupsd: HidUps.cpp:112 Not an APC device.
> 0.045 apcupsd: HidUps.cpp:68 002:002 - 051d:0003
> 0.050 apcupsd: HidUps.cpp:232 Got string of length=16
> 0.050 apcupsd: HidUps.cpp:151 device='AS1505230549', user='/dev/ugen0'
> 0.051 apcupsd: HidUps.cpp:68 003:001 - 8086:
> 0.051 apcupsd: HidUps.cpp:112 Not an APC device.
> 0.051 apcupsd: HidUps.cpp:68 004:001 - 8086:
> 0.051 apcupsd: HidUps.cpp:112 Not an APC device.
> 0.051 apcupsd: HidUps.cpp:68 005:001 - 8086:
> 0.051 apcupsd: HidUps.cpp:112 Not an APC device.
> 0.051 apcupsd: HidUps.cpp:68 006:001 - 8086:
> 0.051 apcupsd: HidUps.cpp:112 Not an APC device.
> 0.051 apcupsd: HidUps.cpp:68 007:001 - 8086:
> 0.051 apcupsd: HidUps.cpp:112 Not an APC device.
> 0.051 apcupsd: newups.c:108 write_unlock at generic-usb.c:471
> 5.055 apcupsd: newups.c:102 write_lock at generic-usb.c:457
> 5.056 apcupsd: HidUps.cpp:50 Initializing libusb
> 5.062 apcupsd: HidUps.cpp:55 Found 0 USB busses
> 5.066 apcupsd: HidUps.cpp:57 Found 0 USB devices
> 5.066 apcupsd: HidUps.cpp:68 000:001 - 8086:
> 5.066 apcupsd: HidUps.cpp:112 Not an APC device.
> 5.066 apcupsd: HidUps.cpp:68 001:001 - 8086:
> 5.066 apcupsd: HidUps.cpp:112 Not an APC device.
> 5.066 apcupsd: HidUps.cpp:68 002:001 - 8086:
> 5.066 apcupsd: HidUps.cpp:112 Not an APC device.
> 5.066 apcupsd: HidUps.cpp:68 002:002 - 051d:0003
> 5.070 apcupsd: HidUps.cpp:232 Got string of length=16
> 5.070 apcupsd: HidUps.cpp:151 device='AS1505230549', user='/dev/ugen0'
> 5.070 apcupsd: HidUps.cpp:68 003:001 - 8086:
> 5.070 apcupsd: HidUps.cpp:112 Not an APC device.
> 5.070 apcupsd: HidUps.cpp:68 

Re: sysutils/apcupsd with USB cable broken in latest snap

2016-06-07 Thread Johan Huldtgren

On 6/7/16 07:37, Kirill Bychkov wrote:


apcupsd was switched from "bsd" driver to "generic-usb" driver after
USB_GET_STRING_DESC removal. In 3.14.14 "generic-usb" is on by default. It
works through libusb from ports.

I've updated my machine to recent amd64 snapshot and updated apcupsd from
packages. Everything works fine.
I've rebuild apcupsd from ports and reinstalled it and it's still works fine:

kirby@humppalaki:ttyp0 %  apcaccess
APC  : 001,045,1057
DATE : 2016-06-07 14:24:02 +0300
HOSTNAME : humppalaki
VERSION  : 3.14.14 (31 May 2016) openbsd
UPSNAME  : rs500
CABLE: USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2016-06-07 14:23:59 +0300
MODEL: Back-UPS CS 500
STATUS   : ONLINE
LINEV: 228.0 Volts
LOADPCT  : 18.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 28.4 Minutes
MBATTCHG : 10 Percent
MINTIMEL : 5 Minutes
MAXTIME  : 0 Seconds
OUTPUTV  : 230.0 Volts
SENSE: Medium
DWAKE: 0 Seconds
DSHUTD   : 180 Seconds
LOTRANS  : 180.0 Volts
HITRANS  : 266.0 Volts
RETPCT   : 0.0 Percent
ITEMP: 29.2 C
ALARMDEL : 30 Seconds
BATTV: 13.5 Volts
LINEFREQ : 50.0 Hz
LASTXFER : Low line voltage
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STESTI   : None
STATFLAG : 0x0508
MANDATE  : 2011-11-19
SERIALNO : 4B1147P44167
BATTDATE : 2011-11-19
NOMOUTV  : 230 Volts
NOMINV   : 0 Volts
NOMBATTV : 12.0 Volts
NOMPOWER : 300 Watts
FIRMWARE : 808.q10 .I USB FW:q
END APC  : 2016-06-07 14:24:03 +0300

ugen0 at uhub5 port 1 "American Power Conversion Back-UPS CS 500 FW:808.q10 .I
USB FW:q10" rev 1.10/0.06 addr 2


ok, on the off chance that this was an amd64 vs i386 issue (unlikely
but figured it couldn't hurt to try) I installed the latest amd64 snap
on a different host and updated ports (I had apcupsd installed here in
client mode), attached the UPS and swapped the config file to the
server one, but alas the results are the same. Must be an issue with
my UPS and the new code I guess.

On 6/7/16 08:12, Stuart Henderson wrote:

I am pretty sure you will have the broken behaviour with 3.4.14 on
the old kernel too, which would suggest that there's a problem with
apcupsd's generic usb code either on OpenBSD or in your configuration
(e.g. with your UPS etc).

The easiest case would probably be if you can find someone who has
a working 3.4.14 on -current. If so, I'd install the same, obtain debug
logs and compare with theirs. If there's nothing obvious then maybe
ask upstream for suggestions.


So I started poking around, and this might be relevant

# apctest
2016-06-07 20:18:30 apctest 3.14.14 (31 May 2016) openbsd
Checking configuration ...
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
apctest FATAL ERROR in apctest.c at line 321
Unable to open UPS device.
  If apcupsd or apctest is already running,
  please stop it and run this program again.
apctest error termination completed

(it should be noted nothing was running at this time, I had just
rebooted the host with apcupsd disabled)

Further when setting the debug high and running it on the console I
get this:

# apcupsd -d 666
0.000 apcupsd: apcupsd.c:156 Options parsed.
0.001 apcupsd: apcconfig.c:755 After config scriptdir: "/etc/apcupsd"
0.001 apcupsd: apcconfig.c:756 After config pwrfailpath: "/etc/apcupsd"
0.001 apcupsd: apcconfig.c:757 After config nologinpath: "/etc"
0.001 apcupsd: apcupsd.c:179 Config file /etc/apcupsd/apcupsd.conf 
processed.

0.001 apcupsd: newups.c:102 write_lock at drivers.c:109
0.001 apcupsd: drivers.c:111 Looking for driver: usb
0.001 apcupsd: drivers.c:115 Driver dumb is configured.
0.001 apcupsd: drivers.c:115 Driver apcsmart is configured.
0.001 apcupsd: drivers.c:115 Driver net is configured.
0.001 apcupsd: drivers.c:115 Driver usb is configured.
0.002 apcupsd: drivers.c:118 Driver usb found and attached.
0.002 apcupsd: newups.c:108 write_unlock at drivers.c:135
0.002 apcupsd: drivers.c:137 Driver ptr=0xb223d800
0.002 apcupsd: drivers.c:138 Attached to driver: usb
0.012 apcupsd: apcupsd.c:251 NIS thread started.
0.013 apcupsd: apclog.c:62 apcupsd 3.14.14 (31 May 2016) openbsd startup 
succeeded

0.014 apcupsd: apclog.c:62 NIS server startup succeeded
0.023 apcupsd: newups.c:102 write_lock at generic-usb.c:457
0.023 apcupsd: HidUps.cpp:50 Initializing libusb
0.033 apcupsd: HidUps.cpp:55 Found 8 USB busses
0.045 apcupsd: HidUps.cpp:57 Found 9 USB devices
0.045 apcupsd: HidUps.cpp:68 000:001 - 8086:
0.045 apcupsd: HidUps.cpp:112 Not an APC device.
0.045 apcupsd: HidUps.cpp:68 001:001 - 8086:
0.045 apcupsd: HidUps.cpp:112 Not an APC device.
0.045 apcupsd: HidUps.cpp:68 002:001 - 8086:
0.045 apcupsd: HidUps.cpp:112 Not an APC device.
0.045 apcupsd: HidUps.cpp:68 002:002 - 051d:0003
0.050 apcupsd: HidUps.cpp:232 Got string of length=16
0.050 apcupsd: HidUps.cpp:151 device='AS1505230549', user='/dev/ugen0'
0.051 apcupsd: HidUps.cpp:68 003:001 - 8086:
0.051 apcupsd: 

Re: sysutils/apcupsd with USB cable broken in latest snap

2016-06-07 Thread Stuart Henderson
On 2016/06/07 06:56, Johan Huldtgren wrote:
> On 6/7/16 03:21, Martin Pieuchot wrote:
> > On 06/06/16(Mon) 19:01, Johan Huldtgren wrote:
> > > hello,
> > > 
> > > I have an APC Smart-UPS-2200 which is connected via USB, as long as
> > > I've followed the instructions in pkg-readme about disabling uhidev
> > > and upd it's always worked fine. When I updated to the latest snap
> > > (June 4th) however I am now always seeing "COMMLOST" in the output of
> > > 'apcaccess status' I tried booting the previous kernel (May 19th,
> > > #1709), but that did not resolve it, it seems the breakage occurred
> > > when apcupsd went from 3.14.13p1 to 3.14.13p2 which seems to have been
> > > because the removal of USB_GET_STRING_DESC. I did try the newly
> > > committed (but as yet unpackaged) 3.14.14 but no more luck there.
> > > 
> > > I tried to build 3.14.13p1 to see if I can confirm what broke it, but
> > > I've been unable to succeed. I backed out the USB_GET_STRING_DESC
> > > changes and built a new kernel based on sources from around
> > > 2016-05-20, I tried to do the same thing with the ports tree but
> > > clearly I've missed something, because I never make it further than:
> > > 
> > > make[5]: Entering directory
> > > '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
> > >   CXX   src/drivers/usb/bsd/hidutils.c
> > > if test ! -d .obj; then mkdir -p .obj; fi
> > > c++ -x c++ -I/usr/local/include
> > > -I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/libusbhid
> > > -I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/include  -O2 -pipe
> > > -fno-exceptions -fno-rtti -Wall -pthread -c -o .obj/hidutils.o hidutils.c
> > > hidutils.c: In function 'const char* hidu_get_string(int, int)':
> > > hidutils.c:354: error: 'USB_GET_STRING_DESC' was not declared in this 
> > > scope

You would need to install the old headers as well (at least
dev/usb/usb.h), not just build the old kernel.

The difference between 3.14.13p1 and 3.14.13p2 is that it switched
from upstream's BSD-specific USB code (that used USB_GET_STRING_DESC)
to generic USB code (that doesn't).

In the 3.14.14 port update the configure flag was removed again
but that's because upstream have switched to the generic code
for all non-Linux systems, i.e. it's now the default. The bsd-
specific code is still present in the tar but is unused.

> > Does it work if you use the system libusbhid instead of the bundled one?
> 
> I'm not exactly sure how to do this, but I'll take a look at it this
> evening when I'm back from work.

It's not quite so simple, they link a C++ file into the library too.
You could try copying the c/h files from src/lib/libusbhid across but
it doesn't build as-is there, at least without sprinkling casts.

I am pretty sure you will have the broken behaviour with 3.4.14 on
the old kernel too, which would suggest that there's a problem with
apcupsd's generic usb code either on OpenBSD or in your configuration
(e.g. with your UPS etc).

The easiest case would probably be if you can find someone who has
a working 3.4.14 on -current. If so, I'd install the same, obtain debug
logs and compare with theirs. If there's nothing obvious then maybe
ask upstream for suggestions.



Re: sysutils/apcupsd with USB cable broken in latest snap

2016-06-07 Thread Kirill Bychkov
On Tue, June 7, 2016 13:56, Johan Huldtgren wrote:
> On 6/7/16 03:21, Martin Pieuchot wrote:
>> On 06/06/16(Mon) 19:01, Johan Huldtgren wrote:
>>> hello,
>>>
>>> I have an APC Smart-UPS-2200 which is connected via USB, as long as
>>> I've followed the instructions in pkg-readme about disabling uhidev
>>> and upd it's always worked fine. When I updated to the latest snap
>>> (June 4th) however I am now always seeing "COMMLOST" in the output of
>>> 'apcaccess status' I tried booting the previous kernel (May 19th,
>>> #1709), but that did not resolve it, it seems the breakage occurred
>>> when apcupsd went from 3.14.13p1 to 3.14.13p2 which seems to have been
>>> because the removal of USB_GET_STRING_DESC. I did try the newly
>>> committed (but as yet unpackaged) 3.14.14 but no more luck there.
>>>
>>> I tried to build 3.14.13p1 to see if I can confirm what broke it, but
>>> I've been unable to succeed. I backed out the USB_GET_STRING_DESC
>>> changes and built a new kernel based on sources from around
>>> 2016-05-20, I tried to do the same thing with the ports tree but
>>> clearly I've missed something, because I never make it further than:
>>>
>>> make[5]: Entering directory
>>> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
>>>   CXX   src/drivers/usb/bsd/hidutils.c
>>> if test ! -d .obj; then mkdir -p .obj; fi
>>> c++ -x c++ -I/usr/local/include
>>> -I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/libusbhid
>>> -I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/include  -O2 -pipe
>>> -fno-exceptions -fno-rtti -Wall -pthread -c -o .obj/hidutils.o hidutils.c
>>> hidutils.c: In function 'const char* hidu_get_string(int, int)':
>>> hidutils.c:354: error: 'USB_GET_STRING_DESC' was not declared in this scope
>>> ../../../../autoconf/targets.mak:141: recipe for target '.obj/hidutils.o'
>>> failed
>>> gmake[5]: *** [.obj/hidutils.o] Error 1
>>> gmake[5]: Leaving directory
>>> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
>>> ../../../../autoconf/targets.mak:55: recipe for target 'all' failed
>>> gmake[4]: *** [all] Error 2
>>> gmake[4]: Leaving directory
>>> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
>>> ../../../autoconf/targets.mak:105: recipe for target 'bsd_DIR' failed
>>> gmake[3]: *** [bsd_DIR] Error 2
>>> gmake[3]: Leaving directory
>>> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb'
>>> ../../autoconf/targets.mak:105: recipe for target 'usb_DIR' failed
>>> gmake[2]: *** [usb_DIR] Error 2
>>> gmake[2]: Leaving directory
>>> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers'
>>> ../autoconf/targets.mak:105: recipe for target 'drivers_DIR' failed
>>> gmake[1]: *** [drivers_DIR] Error 2
>>> gmake[1]: Leaving directory
>>> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src'
>>> autoconf/targets.mak:105: recipe for target 'src_DIR' failed
>>> gmake: *** [src_DIR] Error 2
>>> *** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2675
>>> '/usr/ports/pobj/apcupsd-3.14.13/.build_done')
>>> *** Error 1 in /usr/ports/sysutils/apcupsd
>>> (/usr/ports/infrastructure/mk/bsd.port.mk:2397 'all')
>>>
>>> any clues?
>>
>> Does it work if you use the system libusbhid instead of the bundled one?
>
> I'm not exactly sure how to do this, but I'll take a look at it this
> evening when I'm back from work.
>
> .jh
>

apcupsd was switched from "bsd" driver to "generic-usb" driver after
USB_GET_STRING_DESC removal. In 3.14.14 "generic-usb" is on by default. It
works through libusb from ports.

I've updated my machine to recent amd64 snapshot and updated apcupsd from
packages. Everything works fine.
I've rebuild apcupsd from ports and reinstalled it and it's still works fine:

kirby@humppalaki:ttyp0 %  apcaccess
APC  : 001,045,1057
DATE : 2016-06-07 14:24:02 +0300
HOSTNAME : humppalaki
VERSION  : 3.14.14 (31 May 2016) openbsd
UPSNAME  : rs500
CABLE: USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2016-06-07 14:23:59 +0300
MODEL: Back-UPS CS 500
STATUS   : ONLINE
LINEV: 228.0 Volts
LOADPCT  : 18.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 28.4 Minutes
MBATTCHG : 10 Percent
MINTIMEL : 5 Minutes
MAXTIME  : 0 Seconds
OUTPUTV  : 230.0 Volts
SENSE: Medium
DWAKE: 0 Seconds
DSHUTD   : 180 Seconds
LOTRANS  : 180.0 Volts
HITRANS  : 266.0 Volts
RETPCT   : 0.0 Percent
ITEMP: 29.2 C
ALARMDEL : 30 Seconds
BATTV: 13.5 Volts
LINEFREQ : 50.0 Hz
LASTXFER : Low line voltage
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STESTI   : None
STATFLAG : 0x0508
MANDATE  : 2011-11-19
SERIALNO : 4B1147P44167
BATTDATE : 2011-11-19
NOMOUTV  : 230 Volts
NOMINV   : 0 Volts
NOMBATTV : 12.0 Volts
NOMPOWER : 300 Watts
FIRMWARE : 808.q10 .I USB FW:q
END APC  : 2016-06-07 14:24:03 +0300

ugen0 at uhub5 port 1 "American Power Conversion Back-UPS CS 500 FW:808.q10 .I
USB FW:q10" rev 1.10/0.06 addr 2




Re: sysutils/apcupsd with USB cable broken in latest snap

2016-06-07 Thread Johan Huldtgren

On 6/7/16 03:21, Martin Pieuchot wrote:

On 06/06/16(Mon) 19:01, Johan Huldtgren wrote:

hello,

I have an APC Smart-UPS-2200 which is connected via USB, as long as
I've followed the instructions in pkg-readme about disabling uhidev
and upd it's always worked fine. When I updated to the latest snap
(June 4th) however I am now always seeing "COMMLOST" in the output of
'apcaccess status' I tried booting the previous kernel (May 19th,
#1709), but that did not resolve it, it seems the breakage occurred
when apcupsd went from 3.14.13p1 to 3.14.13p2 which seems to have been
because the removal of USB_GET_STRING_DESC. I did try the newly
committed (but as yet unpackaged) 3.14.14 but no more luck there.

I tried to build 3.14.13p1 to see if I can confirm what broke it, but
I've been unable to succeed. I backed out the USB_GET_STRING_DESC
changes and built a new kernel based on sources from around
2016-05-20, I tried to do the same thing with the ports tree but
clearly I've missed something, because I never make it further than:

make[5]: Entering directory
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
  CXX   src/drivers/usb/bsd/hidutils.c
if test ! -d .obj; then mkdir -p .obj; fi
c++ -x c++ -I/usr/local/include
-I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/libusbhid
-I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/include  -O2 -pipe
-fno-exceptions -fno-rtti -Wall -pthread -c -o .obj/hidutils.o hidutils.c
hidutils.c: In function 'const char* hidu_get_string(int, int)':
hidutils.c:354: error: 'USB_GET_STRING_DESC' was not declared in this scope
../../../../autoconf/targets.mak:141: recipe for target '.obj/hidutils.o'
failed
gmake[5]: *** [.obj/hidutils.o] Error 1
gmake[5]: Leaving directory
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
../../../../autoconf/targets.mak:55: recipe for target 'all' failed
gmake[4]: *** [all] Error 2
gmake[4]: Leaving directory
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
../../../autoconf/targets.mak:105: recipe for target 'bsd_DIR' failed
gmake[3]: *** [bsd_DIR] Error 2
gmake[3]: Leaving directory
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb'
../../autoconf/targets.mak:105: recipe for target 'usb_DIR' failed
gmake[2]: *** [usb_DIR] Error 2
gmake[2]: Leaving directory
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers'
../autoconf/targets.mak:105: recipe for target 'drivers_DIR' failed
gmake[1]: *** [drivers_DIR] Error 2
gmake[1]: Leaving directory
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src'
autoconf/targets.mak:105: recipe for target 'src_DIR' failed
gmake: *** [src_DIR] Error 2
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2675
'/usr/ports/pobj/apcupsd-3.14.13/.build_done')
*** Error 1 in /usr/ports/sysutils/apcupsd
(/usr/ports/infrastructure/mk/bsd.port.mk:2397 'all')

any clues?


Does it work if you use the system libusbhid instead of the bundled one?


I'm not exactly sure how to do this, but I'll take a look at it this
evening when I'm back from work.

.jh



Re: sysutils/apcupsd with USB cable broken in latest snap

2016-06-07 Thread Kirill Bychkov
On Tue, June 7, 2016 02:01, Johan Huldtgren wrote:
> hello,
>
> I have an APC Smart-UPS-2200 which is connected via USB, as long as
> I've followed the instructions in pkg-readme about disabling uhidev
> and upd it's always worked fine. When I updated to the latest snap
> (June 4th) however I am now always seeing "COMMLOST" in the output of
> 'apcaccess status' I tried booting the previous kernel (May 19th,
> #1709), but that did not resolve it, it seems the breakage occurred
> when apcupsd went from 3.14.13p1 to 3.14.13p2 which seems to have been
> because the removal of USB_GET_STRING_DESC. I did try the newly
> committed (but as yet unpackaged) 3.14.14 but no more luck there.
>
> I tried to build 3.14.13p1 to see if I can confirm what broke it, but
> I've been unable to succeed. I backed out the USB_GET_STRING_DESC
> changes and built a new kernel based on sources from around
> 2016-05-20, I tried to do the same thing with the ports tree but
> clearly I've missed something, because I never make it further than:
>
> make[5]: Entering directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
>CXX   src/drivers/usb/bsd/hidutils.c
> if test ! -d .obj; then mkdir -p .obj; fi
> c++ -x c++ -I/usr/local/include
> -I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/libusbhid
> -I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/include  -O2 -pipe
> -fno-exceptions -fno-rtti -Wall -pthread -c -o .obj/hidutils.o hidutils.c
> hidutils.c: In function 'const char* hidu_get_string(int, int)':
> hidutils.c:354: error: 'USB_GET_STRING_DESC' was not declared in this scope
> ../../../../autoconf/targets.mak:141: recipe for target
> '.obj/hidutils.o' failed
> gmake[5]: *** [.obj/hidutils.o] Error 1
> gmake[5]: Leaving directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
> ../../../../autoconf/targets.mak:55: recipe for target 'all' failed
> gmake[4]: *** [all] Error 2
> gmake[4]: Leaving directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
> ../../../autoconf/targets.mak:105: recipe for target 'bsd_DIR' failed
> gmake[3]: *** [bsd_DIR] Error 2
> gmake[3]: Leaving directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb'
> ../../autoconf/targets.mak:105: recipe for target 'usb_DIR' failed
> gmake[2]: *** [usb_DIR] Error 2
> gmake[2]: Leaving directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers'
> ../autoconf/targets.mak:105: recipe for target 'drivers_DIR' failed
> gmake[1]: *** [drivers_DIR] Error 2
> gmake[1]: Leaving directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src'
> autoconf/targets.mak:105: recipe for target 'src_DIR' failed
> gmake: *** [src_DIR] Error 2
> *** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2675
> '/usr/ports/pobj/apcupsd-3.14.13/.build_done')
> *** Error 1 in /usr/ports/sysutils/apcupsd
> (/usr/ports/infrastructure/mk/bsd.port.mk:2397 'all')
>
> any clues?

Hi!
I have no issues on penBSD 5.9-current (GENERIC.MP) #2003: Tue May  3 13:58:33
MDT 2016 with 3.14.14 and ugen0 at uhub5 port 1 "American Power Conversion
Back-UPS CS 500 FW:808.q10 .I USB FW:q10" rev 1.10/0.06 addr 2.

I'll take a closer look at it in the evening.

>
> Below is a dmesg from current, as well as output from usbdevs
> and apcaccess.
>
> thanks,
>
> .jh
>
> 
>
> # dmesg
> OpenBSD 6.0-beta (GENERIC) #1783: Sat Jun  4 20:02:48 MDT 2016
>  dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
> cpu0: Intel(R) Pentium(R) 4 Mobile CPU 1.70GHz ("GenuineIntel"
> 686-class) 1.20 GHz
> cpu0:
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PERF
> real mem  = 536240128 (511MB)
> avail mem = 513286144 (489MB)
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: date 01/07/04, BIOS32 rev. 0 @ 0xffe90, SMBIOS rev.
> 2.3 @ 0xf76b0 (62 entries)
> bios0: vendor Dell Computer Corporation version "A11" date 01/07/2004
> bios0: Dell Computer Corporation Inspiron 8200
> acpi0 at bios0: rev 0
> acpi0: sleep states S0 S1 S3 S4 S5
> acpi0: tables DSDT FACP
> acpi0: wakeup devices LID_(S3) PBTN(S4) PCI0(S3) UAR1(S3) USB0(S1)
> USB1(S1) USB2(S1) MODM(S3) PCIE(S3) MPCI(S3)
> acpitimer0 at acpi0: 3579545 Hz, 24 bits
> acpiprt0 at acpi0: bus 0 (PCI0)
> acpiprt1 at acpi0: bus 1 (AGP_)
> acpiprt2 at acpi0: bus 2 (PCIE)
> acpiprt3 at acpi0: bus -1 (MPCI)
> acpicpu0 at acpi0acpicpu0: struck PSS entry, core frequency equals  last
> acpicpu0: struck PSS entry, core frequency equals  last
> acpicpu0: invalid _PSS length
> : !C2(@50 io@0x8e4), C1(@1 halt!)
> acpipwrres0 at acpi0: PADA, resource for ADPT
> acpitz0 at acpi0: critical temperature is 94 degC
> acpiac0 at acpi0: AC unit online
> acpibat0 at acpi0: BAT0 not present
> acpibat1 at acpi0: BAT1 model "LIP8120DLP" serial 20216 type LION oem
> "Sony Corp."
> acpibtn0 at acpi0: LID_
> acpibtn1 at acpi0: PBTN
> acpibtn2 at acpi0: SBTN
> "PNP0F13" 

Re: sysutils/apcupsd with USB cable broken in latest snap

2016-06-07 Thread Martin Pieuchot
On 06/06/16(Mon) 19:01, Johan Huldtgren wrote:
> hello,
> 
> I have an APC Smart-UPS-2200 which is connected via USB, as long as
> I've followed the instructions in pkg-readme about disabling uhidev
> and upd it's always worked fine. When I updated to the latest snap
> (June 4th) however I am now always seeing "COMMLOST" in the output of
> 'apcaccess status' I tried booting the previous kernel (May 19th,
> #1709), but that did not resolve it, it seems the breakage occurred
> when apcupsd went from 3.14.13p1 to 3.14.13p2 which seems to have been
> because the removal of USB_GET_STRING_DESC. I did try the newly
> committed (but as yet unpackaged) 3.14.14 but no more luck there.
> 
> I tried to build 3.14.13p1 to see if I can confirm what broke it, but
> I've been unable to succeed. I backed out the USB_GET_STRING_DESC
> changes and built a new kernel based on sources from around
> 2016-05-20, I tried to do the same thing with the ports tree but
> clearly I've missed something, because I never make it further than:
> 
> make[5]: Entering directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
>   CXX   src/drivers/usb/bsd/hidutils.c
> if test ! -d .obj; then mkdir -p .obj; fi
> c++ -x c++ -I/usr/local/include
> -I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/libusbhid
> -I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/include  -O2 -pipe
> -fno-exceptions -fno-rtti -Wall -pthread -c -o .obj/hidutils.o hidutils.c
> hidutils.c: In function 'const char* hidu_get_string(int, int)':
> hidutils.c:354: error: 'USB_GET_STRING_DESC' was not declared in this scope
> ../../../../autoconf/targets.mak:141: recipe for target '.obj/hidutils.o'
> failed
> gmake[5]: *** [.obj/hidutils.o] Error 1
> gmake[5]: Leaving directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
> ../../../../autoconf/targets.mak:55: recipe for target 'all' failed
> gmake[4]: *** [all] Error 2
> gmake[4]: Leaving directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'
> ../../../autoconf/targets.mak:105: recipe for target 'bsd_DIR' failed
> gmake[3]: *** [bsd_DIR] Error 2
> gmake[3]: Leaving directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb'
> ../../autoconf/targets.mak:105: recipe for target 'usb_DIR' failed
> gmake[2]: *** [usb_DIR] Error 2
> gmake[2]: Leaving directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers'
> ../autoconf/targets.mak:105: recipe for target 'drivers_DIR' failed
> gmake[1]: *** [drivers_DIR] Error 2
> gmake[1]: Leaving directory
> '/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src'
> autoconf/targets.mak:105: recipe for target 'src_DIR' failed
> gmake: *** [src_DIR] Error 2
> *** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2675
> '/usr/ports/pobj/apcupsd-3.14.13/.build_done')
> *** Error 1 in /usr/ports/sysutils/apcupsd
> (/usr/ports/infrastructure/mk/bsd.port.mk:2397 'all')
> 
> any clues?

Does it work if you use the system libusbhid instead of the bundled one?



sysutils/apcupsd with USB cable broken in latest snap

2016-06-06 Thread Johan Huldtgren

hello,

I have an APC Smart-UPS-2200 which is connected via USB, as long as
I've followed the instructions in pkg-readme about disabling uhidev
and upd it's always worked fine. When I updated to the latest snap
(June 4th) however I am now always seeing "COMMLOST" in the output of
'apcaccess status' I tried booting the previous kernel (May 19th,
#1709), but that did not resolve it, it seems the breakage occurred
when apcupsd went from 3.14.13p1 to 3.14.13p2 which seems to have been
because the removal of USB_GET_STRING_DESC. I did try the newly
committed (but as yet unpackaged) 3.14.14 but no more luck there.

I tried to build 3.14.13p1 to see if I can confirm what broke it, but
I've been unable to succeed. I backed out the USB_GET_STRING_DESC
changes and built a new kernel based on sources from around
2016-05-20, I tried to do the same thing with the ports tree but
clearly I've missed something, because I never make it further than:

make[5]: Entering directory 
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'

  CXX   src/drivers/usb/bsd/hidutils.c
if test ! -d .obj; then mkdir -p .obj; fi
c++ -x c++ -I/usr/local/include 
-I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/libusbhid 
-I/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/include  -O2 -pipe 
-fno-exceptions -fno-rtti -Wall -pthread -c -o .obj/hidutils.o hidutils.c

hidutils.c: In function 'const char* hidu_get_string(int, int)':
hidutils.c:354: error: 'USB_GET_STRING_DESC' was not declared in this scope
../../../../autoconf/targets.mak:141: recipe for target 
'.obj/hidutils.o' failed

gmake[5]: *** [.obj/hidutils.o] Error 1
gmake[5]: Leaving directory 
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'

../../../../autoconf/targets.mak:55: recipe for target 'all' failed
gmake[4]: *** [all] Error 2
gmake[4]: Leaving directory 
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb/bsd'

../../../autoconf/targets.mak:105: recipe for target 'bsd_DIR' failed
gmake[3]: *** [bsd_DIR] Error 2
gmake[3]: Leaving directory 
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers/usb'

../../autoconf/targets.mak:105: recipe for target 'usb_DIR' failed
gmake[2]: *** [usb_DIR] Error 2
gmake[2]: Leaving directory 
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src/drivers'

../autoconf/targets.mak:105: recipe for target 'drivers_DIR' failed
gmake[1]: *** [drivers_DIR] Error 2
gmake[1]: Leaving directory 
'/usr/ports/pobj/apcupsd-3.14.13/apcupsd-3.14.13/src'

autoconf/targets.mak:105: recipe for target 'src_DIR' failed
gmake: *** [src_DIR] Error 2
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2675 
'/usr/ports/pobj/apcupsd-3.14.13/.build_done')
*** Error 1 in /usr/ports/sysutils/apcupsd 
(/usr/ports/infrastructure/mk/bsd.port.mk:2397 'all')


any clues?

Below is a dmesg from current, as well as output from usbdevs
and apcaccess.

thanks,

.jh



# dmesg
OpenBSD 6.0-beta (GENERIC) #1783: Sat Jun  4 20:02:48 MDT 2016
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel(R) Pentium(R) 4 Mobile CPU 1.70GHz ("GenuineIntel" 
686-class) 1.20 GHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PERF

real mem  = 536240128 (511MB)
avail mem = 513286144 (489MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 01/07/04, BIOS32 rev. 0 @ 0xffe90, SMBIOS rev. 
2.3 @ 0xf76b0 (62 entries)

bios0: vendor Dell Computer Corporation version "A11" date 01/07/2004
bios0: Dell Computer Corporation Inspiron 8200
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP
acpi0: wakeup devices LID_(S3) PBTN(S4) PCI0(S3) UAR1(S3) USB0(S1) 
USB1(S1) USB2(S1) MODM(S3) PCIE(S3) MPCI(S3)

acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (AGP_)
acpiprt2 at acpi0: bus 2 (PCIE)
acpiprt3 at acpi0: bus -1 (MPCI)
acpicpu0 at acpi0acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: struck PSS entry, core frequency equals  last
acpicpu0: invalid _PSS length
: !C2(@50 io@0x8e4), C1(@1 halt!)
acpipwrres0 at acpi0: PADA, resource for ADPT
acpitz0 at acpi0: critical temperature is 94 degC
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 not present
acpibat1 at acpi0: BAT1 model "LIP8120DLP" serial 20216 type LION oem 
"Sony Corp."

acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: PBTN
acpibtn2 at acpi0: SBTN
"PNP0F13" at acpi0 not configured
"PNP0303" at acpi0 not configured
"PNP0700" at acpi0 not configured
"PNP0501" at acpi0 not configured
"PNP0401" at acpi0 not configured
acpidock0 at acpi0: GDCK not docked (0)
acpivideo0 at acpi0: VID_
bios0: ROM list: 0xc/0xf800 0xcf800/0x800!
cpu0 at mainbus0: (uniprocessor)
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82845 Host" rev 0x04
intelagp0 at pchb0