From owner-freebsd-usb@FreeBSD.ORG Sun Dec 7 22:59:10 2014 Return-Path: Delivered-To: freebsd-usb@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9DBAC97A for ; Sun, 7 Dec 2014 22:59:10 +0000 (UTC) Received: from galore.getmail.no (galore.getmail.no [84.210.184.6]) by mx1.freebsd.org (Postfix) with ESMTP id 50F82F09 for ; Sun, 7 Dec 2014 22:59:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by galore.getmail.no (Postfix) with ESMTP id C60885EB23 for ; Sun, 7 Dec 2014 23:52:19 +0100 (CET) Received: from galore.getmail.no ([127.0.0.1]) by localhost (galore.get.c.bitbit.net [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id cIsa-LmqUInq for ; Sun, 7 Dec 2014 23:52:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by galore.getmail.no (Postfix) with ESMTP id 35F7F5EB20 for ; Sun, 7 Dec 2014 23:52:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.8.4 galore.getmail.no 35F7F5EB20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getmail.no; s=8A9C8B4C-D727-11E2-8095-B6466E6B3FA2; t=1417992736; bh=sAPTNsfsDeEf1hbQCvl4vvXZhdETMSDQJzhsDMFwKMw=; h=Date:From:To:Subject:Message-Id:Mime-Version:Content-Type: Content-Transfer-Encoding; b=wkwbF7F19eOMgZ0Icnffo10ZV+KkAAj/f4uuG2GemujopaHzi1JBpTu4Vzw2jlfV0 qKUzuJHx4BzSRgWbKgWdD95C3Zs+FfDHMjXIYhH7H2Yv5bWVuDByn6D34GfCCzfY5A 7I5/bdJ+9TcxQEruPEwQTokC2nuFyfe6tE+ipb+M= X-Virus-Scanned: amavisd-new at galore.get.c.bitbit.net Received: from galore.getmail.no ([127.0.0.1]) by localhost (galore.get.c.bitbit.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vTron-LBejlU for ; Sun, 7 Dec 2014 23:52:16 +0100 (CET) Received: from kg-core1.kg4.no (cm-84.215.180.206.getinternet.no [84.215.180.206]) by galore.getmail.no (Postfix) with ESMTPSA id 155A45EB1E for ; Sun, 7 Dec 2014 23:52:16 +0100 (CET) Date: Sun, 7 Dec 2014 23:52:13 +0100 From: Torfinn Ingolfsen To: freebsd-usb@FreeBSD.org Subject: Is writing usb devices as files (via /dev/ugen*) supported in FreeBSD? Message-Id: <20141207235213.059d82613b8ca0fa0f14b78e@getmail.no> X-Mailer: Sylpheed 3.4.2 (GTK+ 2.24.22; amd64-portbld-freebsd9.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Dec 2014 22:59:10 -0000 Hello, Question: is writing to the device file (/dev/ugenX) with normal file calls supposed to work in FreeBSD? (as in "everything is a file" in unix-like operating systems) Background: I recently got a usb label printer for cheap: a Dymo LabelManager PnP[1]. I found the dymoprint[2] Python script, which works fairly well on Linux. It works (AFAICT) by reading / writing the usb device as a regular file, via the device file. You have to use usb_modeswitch[3] on the printer first, of course. Since we have all tools available on FreeBSD, I tried the setup on my FreeBSD workstation, which currently runs FreeBSD 9.3-stable: tingo@kg-core1$ uname -a FreeBSD kg-core1.kg4.no 9.3-STABLE FreeBSD 9.3-STABLE #0 r273918: Fri Oct 31 22:52:44 CET 2014 root@kg-core1.kg4.no:/usr/obj/usr/src/sys/GENERIC amd64 The detection code in the dymoprint script doesn't work on FreeBSD, but setting the correct device via DEV_NODE in the script works: tingo@kg-core1$ grep ^DEV_NODE dymoprint2 DEV_NODE = "/dev/ugen3.4" But when I run the script I just get an IO error: root@kg-core1# python dymoprint2 test Traceback (most recent call last): File "dymoprint2", line 313, in main() File "dymoprint2", line 309, in main lm.printLabel(labelmatrix, dottab) File "dymoprint2", line 183, in printLabel response = self.sendCommand() File "dymoprint2", line 80, in sendCommand responseBin = self.dev.read(8) IOError: [Errno 5] Input/output error References: 1) http://global.dymo.com/ieIE/Products/LabelManager_PnP.html 2) http://sbronner.com/dymoprint/ 3) http://www.draisberghof.de/usb_modeswitch/ -- Torfinn Ingolfsen