j T
2006-May-16 15:00 UTC
[Nut-upsdev] NUT: Belkin Universal driver - modification to -k behaviour (diff attached)
Hi I'm sending this to you as it appears that you are the person who looks after and/or supervises the code for NUT's Belkin drivers. I'm using the address you use for the Nut-upsdev mailing list ( selinger at mathstat.dal.ca ). Anyway... I have a Belkin Universal UPS and, having just upgraded my Fedora Core system from 4 to 5 and had to go back through the system RC files re-applying the "soft shutdown workaround," I had an idea with regards to the NUT belkinunv driver's behaviour when run with the -k option. The idea is pretty simplistic, but would hopefully mean that the driver would behave in a manner that is more consistent with other NUT drivers. Basically, instead of -k causing the driver to set a couple of UPS timers and hoping for the best, my version uses the existing "wait" code. I'm not too hot at C, but I've had a go at putting this together (quite a lot of it's cut-n-paste-programming I'm afraid), and it seems to work rather nicely. I have attached the output from running "diff -ud belkinunv.c.orig belkinunv.c" modifying the first line of the diff file so that the diff can be applied to belkinunv.c by doing "patch < belkinunv.diff" (hopefully...) I've updated the driver version for the patched driver to 0.06jo01 so that it is reasonably apparent that this is an alpha version based on 0.06, rather than being presuptuous and calling it 0.07 ;-) I haven't deleted any of my notes and things from the source file before running the Diff, so you can hopefully see what my intentions were... The modifications allow the driver to be used in its current form, as well as in the modified form. This is controlled by a "waitonshutdown = true" line being added to the UPS definition in ups.conf. -- I'm also looking to modify the belkin_hid USB HID subdriver so that it supports both the -x wait[=n] and my modified -k behaviour, but I haven't really gotten anywhere on that just yet... I only started with the belkinunv modification on friday... I have no idea if this modification is something that would be of any use to anyone else, but thought it would be nice to do the whole 'give something back' thing... Sorry for bothering you if it is useless! Jo Turner -xx- -- jT | mail to: hyvan_trant@hotmail.com ** | website: http://www.chiark.greenend.org.uk/~jsturner/ -------------- next part -------------- A non-text attachment was scrubbed... Name: belkinunv.diff Type: application/octet-stream Size: 8866 bytes Desc: not available Url : http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20060515/cd169d61/belkinunv-0002.obj
Peter Selinger
2006-May-16 16:22 UTC
[Nut-upsdev] Re: NUT: Belkin Universal driver - modification to -k behaviour
Hi Jo, thanks for the patch. This seems like a smart idea to me. I have to study your patch carefully though, to make sure it will do the right thing in all situations. I guess your patch would eliminate the need for a custom shutdown script. If I understand correctly, modifications to the startup script would still be required to ensure the computer does not mount any disks in read/write mode until after the battery level is high enough to survive another outage. I tried to forward your message to the nut-upsdev mailing list, but somehow this did not work. I have put the patch on the Alioth tracker instead at http://alioth.debian.org/tracker/index.php?func=detail&aid=303445&group_id=30602&atid=411544 -- Peter> Hi > > I'm sending this to you as it appears that you are the person who looks > after and/or supervises the code for NUT's Belkin drivers. I'm using the > address you use for the Nut-upsdev mailing list ( selinger at > mathstat.dal.ca ). > > Anyway... > > I have a Belkin Universal UPS and, having just upgraded my Fedora Core > system from 4 to 5 and had to go back through the system RC files > re-applying the "soft shutdown workaround," I had an idea with regards to > the NUT belkinunv driver's behaviour when run with the -k option. > > The idea is pretty simplistic, but would hopefully mean that the driver > would behave in a manner that is more consistent with other NUT drivers. > Basically, instead of -k causing the driver to set a couple of UPS timers > and hoping for the best, my version uses the existing "wait" code. > > I'm not too hot at C, but I've had a go at putting this together (quite a > lot of it's cut-n-paste-programming I'm afraid), and it seems to work rather > nicely. > > I have attached the output from running "diff -ud belkinunv.c.orig > belkinunv.c" modifying the first line of the diff file so that the diff can > be applied to belkinunv.c by doing "patch < belkinunv.diff" (hopefully...) > > I've updated the driver version for the patched driver to 0.06jo01 so that > it is reasonably apparent that this is an alpha version based on 0.06, > rather than being presuptuous and calling it 0.07 ;-) > > I haven't deleted any of my notes and things from the source file before > running the Diff, so you can hopefully see what my intentions were... > > The modifications allow the driver to be used in its current form, as well > as in the modified form. This is controlled by a "waitonshutdown = true" > line being added to the UPS definition in ups.conf. > > -- > I'm also looking to modify the belkin_hid USB HID subdriver so that it > supports both the -x wait[=n] > and my modified -k behaviour, but I haven't really gotten anywhere on that > just yet... I only started with the belkinunv modification on friday... > > I have no idea if this modification is something that would be of any use to > anyone else, but thought it would be nice to do the whole 'give something > back' thing... > > Sorry for bothering you if it is useless! > > Jo Turner > -xx- >