[Nut-upsuser] megatec_usb vs Mustek NetGuard / Ippon SmartWinner problem

2009-02-19 Thread Oleg Pshenychnyy
Greetings Gentlemen,

I have Mustek NetGuard 1000 UPS which is equivalent to Ippon SmartWinner
1000.
I have tried to run several latest builds of NUT, but run megatec_usb driver
still failed with my device.
I hope the information below might help.

Regards,
Oleg

Here is the information which may help:

lsusb -v

Bus 002 Device 002: ID 06da:0003 Phoenixtec Power Co., Ltd
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   1.10
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize0 8
  idVendor   0x06da Phoenixtec Power Co., Ltd
  idProduct  0x0003
  bcdDevice2.00
  iManufacturer   3 OMRON
  iProduct1 USB UPS
  iSerial 0
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   34
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0xa0
  Remote Wakeup
MaxPower  100mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass 3 Human Interface Device
  bInterfaceSubClass  0 No Subclass
  bInterfaceProtocol  0 None
  iInterface  0
HID Device Descriptor:
  bLength 9
  bDescriptorType33
  bcdHID   1.11
  bCountryCode0 Not supported
  bNumDescriptors 1
  bDescriptorType34 Report
  wDescriptorLength  27
  Report Descriptor: (length is 27)
Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
(null)
Item(Local ): Usage, data= [ 0x01 ] 1
(null)
Item(Main  ): Collection, data= [ 0x01 ] 1
Application
Item(Local ): Usage, data= [ 0x02 ] 2
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x08 ] 8
Item(Main  ): Input, data= [ 0x82 ] 130
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Volatile
Bitfield
Item(Local ): Usage, data= [ 0x02 ] 2
(null)
Item(Global): Report Count, data= [ 0x08 ] 8
Item(Main  ): Output, data= [ 0x82 ] 130
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Volatile
Bitfield
Item(Main  ): End Collection, data=none
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0008  1x 8 bytes
bInterval  20

vi /proc/bus/usb/devices

T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=1.5 MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=06da ProdID=0003 Rev= 2.00
S:  Manufacturer=OMRON
S:  Product=USB UPS
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=20ms

ups.conf:

[netguard]
driver = megatec_usb
port = auto
vendorid = 06da
desc = "SVEN NetGuard 1000(USB)"

megatec_usb -D -a netguard

Checking device (06DA/0003) (002/002)
- VendorID: 06da
- ProductID: 0003
- Manufacturer: OMRON
- Product: USB UPS
- Serial Number: unknown
- Bus: 002
Trying to match device
Device matches
DTR=1, RTS=0
Starting UPS detection process...
Asking for UPS information [I]...
I => FAILED [short read]
I detail: (1 bytes) => 49
Asking for UPS status [Q1]...
get_data_phoenix: got so far [(213.8 2]
get_data_phoenix: (8 bytes) => 28 32 31 33 2e 38 20 32
3]t_data_phoenix: got so far [(213.8 2001001
get_data_phoenix: (16 bytes) => 28 32 31 33 2e 38 20 32 30 30 31 30 30 31
 0d 33
3.8 031 5]hoenix: got so far [(213.8 2001001
get_data_phoenix: (24 bytes) => 28 32 31 33 2e 38 20 32 30 30 31 30 30 31
 0d 33 2e 38 20 30 33 31 20 35
3.8 031 50.0 27.3]got so far [(213.8 2001001
get_data_phoenix: (32 bytes) => 28 32 31 33 2e 38 20 32 30 30 31 30 30 31
 0d 33 2e 38 20 30 33 31 20 35 30 2e 30 20 32 37 2e 33
3.8 031 50.0 27.3 76.2 00]ar [(213.8 2001001
get_data_phoenix: (40 bytes) => 28 32 31 33 2e 38 20 32 30 30 31 30 30 31
 0d 33 2e 38 20 30 33 31 20

Re: [Nut-upsuser] NUT 2.4.1 crashes on FreeBSD - additional info

2009-02-19 Thread Arjen de Korte
Citeren Volker Theile :

> Ahmmm, just wondering how this could happen and why nobody has realized
> this bug during the testing phase :-)

Testing can only confirm the presence of bugs, not the absence. This  
error was already present since (at least) January 2005, which  
probably means that you need to match a fairly specific set of  
conditions to run into problems here. Apparently, your system did.

Because problems with overflows for (void *) elements in function  
calls are difficult (if at all) possible to spot for compilers, this  
didn't trigger any alarms. The memset() function is probably not  
needed here anyway, so clearing the wrong (global) variable didn't  
lead to problems either. Depending on the size of both 'struct  
sockaddr_un' and 'struct sigaction' it may or may not lead to overflows.

Best regards, Arjen
-- 
Please keep list traffic on the list


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] NUT 2.4.1 crashes on FreeBSD - additional info

2009-02-19 Thread Volker Theile
Aaaarrr seems i was blind yesterday night. I compared this file 
with 2.2.2, registered some changes but did not check them :-( Anyway 
thanks for the patch.

Regards
Volker

Joerg Pulz wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
>
> On Thu, 19 Feb 2009, Arnaud Quette wrote:
>
>> Hi Volker,
>>
>> I forward your request to the user list since I don't currently have 
>> much
>> time to process it.
>> quickly testing 2.4.1, I wasn't able to reproduce it.
>>
>> a question: was it working with the exact same context/config with 
>> 2.2.2?
>
> Dear Arnaud and Volker,
>
> attached is a very small patch which fixes the problem.
> I don't know when this obviously wrong change slipped in as i'm not 
> the big expert in working with SVN and the web frontends where not 
> really helpful.
>
> Anyway, i will submit a PR for the FreeBSD port now, that we get back 
> a fully functional version in the tree.
>
> Kind regards
> Joerg
>
> - -- The beginning is the most important part of the work.
> -Plato
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.9 (FreeBSD)
>
> iD8DBQFJnbELSPOsGF+KA+MRAqukAJ0RFX6UbTj6l+5rZTdWQmpjGnRXzgCeP4yU
> sws8IUikZzpfm8Yptw6ftm4=
> =9qu/
> -END PGP SIGNATURE-
> 
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.0.237 / Virus Database: 270.11.1/1960 - Release Date: 02/19/09 
> 10:48:00
>

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] NUT 2.4.1 crashes on FreeBSD - additional info

2009-02-19 Thread Volker Theile
Ahmmm, just wondering how this could happen and why nobody has realized 
this bug during the testing phase :-)

Joerg Pulz wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
>
> On Thu, 19 Feb 2009, Arnaud Quette wrote:
>
>> Hi Volker,
>>
>> I forward your request to the user list since I don't currently have 
>> much
>> time to process it.
>> quickly testing 2.4.1, I wasn't able to reproduce it.
>>
>> a question: was it working with the exact same context/config with 
>> 2.2.2?
>
> Dear Arnaud and Volker,
>
> attached is a very small patch which fixes the problem.
> I don't know when this obviously wrong change slipped in as i'm not 
> the big expert in working with SVN and the web frontends where not 
> really helpful.
>
> Anyway, i will submit a PR for the FreeBSD port now, that we get back 
> a fully functional version in the tree.
>
> Kind regards
> Joerg
>
> - -- The beginning is the most important part of the work.
> -Plato
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v2.0.9 (FreeBSD)
>
> iD8DBQFJnbELSPOsGF+KA+MRAqukAJ0RFX6UbTj6l+5rZTdWQmpjGnRXzgCeP4yU
> sws8IUikZzpfm8Yptw6ftm4=
> =9qu/
> -END PGP SIGNATURE-
> 
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 8.0.237 / Virus Database: 270.11.1/1960 - Release Date: 02/19/09 
> 10:48:00
>

___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] NUT 2.4.1 crashes on FreeBSD - additional info

2009-02-19 Thread Joerg Pulz

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On Thu, 19 Feb 2009, Arnaud Quette wrote:


Hi Volker,

I forward your request to the user list since I don't currently have much
time to process it.
quickly testing 2.4.1, I wasn't able to reproduce it.

a question: was it working with the exact same context/config with 2.2.2?


Dear Arnaud and Volker,

attached is a very small patch which fixes the problem.
I don't know when this obviously wrong change slipped in as i'm not the 
big expert in working with SVN and the web frontends where not really 
helpful.


Anyway, i will submit a PR for the FreeBSD port now, that we get back a 
fully functional version in the tree.


Kind regards
Joerg

- -- 
The beginning is the most important part of the work.

-Plato
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (FreeBSD)

iD8DBQFJnbELSPOsGF+KA+MRAqukAJ0RFX6UbTj6l+5rZTdWQmpjGnRXzgCeP4yU
sws8IUikZzpfm8Yptw6ftm4=
=9qu/
-END PGP SIGNATURE clients/upssched.c.orig 2009-02-19 20:01:40.0 +0100
+++ clients/upssched.c  2009-02-19 20:02:00.0 +0100
@@ -595,7 +595,7 @@
int pipefd, ret;
struct  sockaddr_un saddr;
 
-   memset(&sa, '\0', sizeof(saddr));
+   memset(&saddr, '\0', sizeof(saddr));
saddr.sun_family = AF_UNIX;
snprintf(saddr.sun_path, sizeof(saddr.sun_path), "%s", pipefn);
 
___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser

Re: [Nut-upsuser] NUT 2.4.1 crashes on FreeBSD - additional info

2009-02-19 Thread Arnaud Quette
Hi Volker,

I forward your request to the user list since I don't currently have much
time to process it.
quickly testing 2.4.1, I wasn't able to reproduce it.

a question: was it working with the exact same context/config with 2.2.2?

cheers,
Arnaud
-- 
Linux / Unix Expert R&D - Eaton - http://www.eaton.com/mgeops
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://people.debian.org/~aquette/
Free Software Developer - http://arnaud.quette.free.fr/

2009/2/18 Volker Theile 

> Hi again,
>
> forgot to mention that i did the tests the following way:
>
> freenas:~# setenv UPSNAME ups
> freenas:~# setenv NOTIFYTYPE ONLINE
> freenas:~# upssched
> Executing command: resume
> Segmentation fault (core dumped)
>
> freenas:~# truss upssched
> __sysctl(0xbfbfea24,0x2,0xbfbfea2c,0xbfbfea30,0x0,0x0) = 0 (0x0)
> mmap(0x0,280,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 671584256 (0x28079000)
> munmap(0x28079000,280)   = 0 (0x0)
> __sysctl(0xbfbfea88,0x2,0x28075d7c,0xbfbfea90,0x0,0x0) = 0 (0x0)
> mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) =
> 671584256 (0x28079000)
> issetugid(0x2806eeac,0xbfbfeb50,0x104,0x0,0x0,0x0) = 0 (0x0)
> open("/etc/libmap.conf",O_RDONLY,0666)   ERR#2 'No such file or
> directory'
> open("/var/run/ld-elf.so.hints",O_RDONLY,00) = 3 (0x3)
> read(3,"ehnt\^a\0\0\0...@\0\0\0\^]\0\0\0"...,128) = 128 (0x80)
> lseek(3,0x80,SEEK_SET)   = 128 (0x80)
> read(3,"/usr/lib:/usr/local/lib:/lib\0",29)  = 29 (0x1d)
> close(3) = 0 (0x0)
> access("/usr/lib/libc.so.7",0)   ERR#2 'No such file or
> directory'
> access("/usr/local/lib/libc.so.7",0) ERR#2 'No such file or
> directory'
> access("/lib/libc.so.7",0)   = 0 (0x0)
> open("/lib/libc.so.7",O_RDONLY,00)   = 3 (0x3)
> fstat(3,{ mode=-rwxr-xr-x ,inode=8054,size=1057976,blksize=4096 }) = 0
> (0x0)
> read(3,"\^?ELF\^A\^A\^A\t\0\0\0\0\0\0\0"...,4096) = 4096 (0x1000)
> mmap(0x0,1056768,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_NOCORE,3,0x0) =
> 671617024 (0x28081000)
> mprotect(0x28168000,4096,PROT_READ|PROT_WRITE|PROT_EXEC) = 0 (0x0)
> mprotect(0x28168000,4096,PROT_READ|PROT_EXEC)= 0 (0x0)
> mmap(0x28169000,24576,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,3,0xe8000)
> = 672567296 (0x28169000)
> mmap(0x2816f000,81920,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0)
> = 672591872 (0x2816f000)
> close(3) = 0 (0x0)
> sysarch(0xa,0xbfbfeaf0,0x2804f16b,0x28074734,0x28060529,0x28074734) = 0
> (0x0)
> mmap(0x0,608,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 672673792 (0x28183000)
> munmap(0x28183000,608)   = 0 (0x0)
> mmap(0x0,21112,PROT_READ|PROT_WRITE,MAP_ANON,-1,0x0) = 672673792
> (0x28183000)
> munmap(0x28183000,21112) = 0 (0x0)
> sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0)
> = 0 (0x0)
> sigprocmask(SIG_SETMASK,0x0,0x0) = 0 (0x0)
> __sysctl(0xbfbfeaa4,0x2,0x2816fae0,0xbfbfeaac,0x0,0x0) = 0 (0x0)
> sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0)
> = 0 (0x0)
> sigprocmask(SIG_SETMASK,0x0,0x0) = 0 (0x0)
> __sysctl(0xbfbfe678,0x2,0x281738c0,0xbfbfe684,0x0,0x0) = 0 (0x0)
> __sysctl(0xbfbfe188,0x2,0x2818005c,0xbfbfe190,0x0,0x0) = 0 (0x0)
> __sysctl(0xbfbfe1d8,0x2,0xbfbfe1e4,0xbfbfe1e8,0x0,0x0) = 0 (0x0)
> readlink("/etc/malloc.conf",0xbfbfe277,1024) ERR#2 'No such file or
> directory'
> issetugid(0x28160aa0,0xbfbfe277,0x400,0xbfbfe684,0x0,0x0) = 0 (0x0)
> break(0x810) = 0 (0x0)
> __sysctl(0xbfbfe514,0x2,0xbfbfe51c,0xbfbfe520,0x0,0x0) = 0 (0x0)
> mmap(0x0,1048576,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) =
> 672673792 (0x28183000)
> mmap(0x28283000,512000,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) =
> 673722368 (0x28283000)
> munmap(0x28183000,512000)= 0 (0x0)
> open("/var/etc/upssched.conf",O_RDONLY,0666) = 3 (0x3)
> fstat(3,{ mode=-rw--- ,inode=63,size=507,blksize=4096 }) = 0 (0x0)
> read(3,"CMDSCRIPT /usr/local/bin/upssche"...,4096) = 507 (0x1fb)
> socket(PF_LOCAL,SOCK_STREAM,0)   = 4 (0x4)
> connect(4,{ AF_UNIX "/var/run/upssched.pipe" },106) ERR#2 'No such file or
> directory'
> Executing command: resume
> write(2,"Executing command: resume\n",26)= 26 (0x1a)
> gettimeofday({1234996218.667506 },0x0)   = 0 (0x0)
> SIGNAL 11 (SIGSEGV)
>
>  Hello,
>>
>> i'm the developer and project leader of FreeNAS which uses NUT UPS. During
>> upgrading from 2.2.2 to 2.4 i realized that i get a core dump in u