From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 29 14:19:34 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2FA9337B401 for ; Sun, 29 Jun 2003 14:19:34 -0700 (PDT) Received: from mail.dada.it (mail3.dada.it [195.110.100.3]) by mx1.FreeBSD.org (Postfix) with SMTP id E4E854401A for ; Sun, 29 Jun 2003 14:19:29 -0700 (PDT) (envelope-from riccardo@torrini.org) Received: (qmail 26563 invoked from network); 29 Jun 2003 21:19:25 -0000 Received: from unknown (HELO trudy.torrini.home) (195.110.114.101) by mail.dada.it with SMTP; 29 Jun 2003 21:19:25 -0000 Received: from trudy.torrini.home (localhost.torrini.home [127.0.0.1]) by trudy.torrini.home (8.12.9/8.12.9) with ESMTP id h5TLJQWf000731 for ; Sun, 29 Jun 2003 23:19:26 +0200 (CEST) (envelope-from riccardo@trudy.torrini.home) Received: (from riccardo@localhost) by trudy.torrini.home (8.12.9/8.12.9/Submit) id h5TLJQNG000730 for freebsd-hackers@FreeBSD.org; Sun, 29 Jun 2003 23:19:26 +0200 (CEST) Date: Sun, 29 Jun 2003 23:19:26 +0200 From: Riccardo Torrini To: freebsd-hackers@FreeBSD.org Message-ID: <20030629211926.GC538@trudy.torrini.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: How to convert a linux-src to access APC USB HID on FreeBSD? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jun 2003 21:19:34 -0000 Hi there, I asked the same question to Nick Hibma but he is very busy and can't help me. If someone know how to convert a linux-src to freebsd to access my UPS I'd happy to test any piece of (non explosive) code he sent me... Also please Cc: me, I'm only on current@. Thanks in advance. I'm trying to interface my new APC (RS 500) with FreeBSD 4.8-STABLE (but if you make a -CURRENT only code I'm able to test it) but after some search I found that all around there are only linux applications and I'm unable to convert them myself to FreeBSD ones. Can you help me? Looking on the net I found apcupsd-3.10.5 but it is a Linux-only src, it has all protocol exposed, would be simple to convert (knowing how linux works, at least). If you know how to help me to convert this single src (linux-usb.c usb.h) to FreeBSD send me a note, I'll be happy to test. I collect all under my local site: ftp://ftp.torrini.org/pub/FreeBSD/APC-hacking/ Also note that linux-usb.c and usb.h are GPL-ed, I simple extract from the original tarball without touching the code. If you need the whole archive search for apcupsd-3.10.5.tar.gz on sourceforge. Even a reduced version able only to acquire time and power would help. # usbdevs -v -d Controller /dev/usb0: addr 1: self powered, config 1, UHCI root hub(0x0000), VIA(0x0000), rev 1.00 uhub0 port 1 powered port 2 addr 2: low speed, self powered, config 1, \ Back-UPS RS 500 FW:30.j2.I USB FW:j2(0x0002), \ American Power Conversion(0x051d), rev 0.06 After playing with usbhidctl I found that my APC use 0xff84, 0xff85 and 0xff86 instead of 0x84, 0x85 and 0x86 as it would so I created a custom file with the contents of /usr/share/misc/usb_hid_usage and with a copy of pages 132/133 to 0xff84/0xff85 and now it decode pages/usages. Now I'm at a dead end, usbhidctl say: device does not support immediate mode, only changes reported. but interrogating device with -a and/or -l show me only zeros. If you need my config/boot.log feel free to download them from: ftp://ftp.torrini.org/pub/FreeBSD/APC-hacking/ What else can I do (apart from changing UPS)? I hope you can point me to the right direction (docs or ML)... -- Riccardo. ( http://www.GUFI.org/~vic/ )