From owner-freebsd-questions@FreeBSD.ORG Thu May 24 13:46:52 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 816F916A46D for ; Thu, 24 May 2007 13:46:52 +0000 (UTC) (envelope-from nvass@teledomenet.gr) Received: from wmail.teledomenet.gr (wmail.teledomenet.gr [213.142.128.16]) by mx1.freebsd.org (Postfix) with ESMTP id 3BD6913C48C for ; Thu, 24 May 2007 13:46:52 +0000 (UTC) (envelope-from nvass@teledomenet.gr) Received: from iris (unknown [192.168.1.71]) by wmail.teledomenet.gr (Postfix) with ESMTP id 289B61C887D; Thu, 24 May 2007 16:46:50 +0300 (EEST) From: Nikos Vassiliadis To: freebsd-questions@freebsd.org Date: Thu, 24 May 2007 16:43:08 +0300 User-Agent: KMail/1.9.1 References: <200705241259.l4OCxliV055742@whoweb.com> In-Reply-To: <200705241259.l4OCxliV055742@whoweb.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-7" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200705241643.08935.nvass@teledomenet.gr> Cc: Subject: Re: can't read raw CD device X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2007 13:46:52 -0000 On Thursday 24 May 2007 15:59, Incoming Mail List wrote: > Hello, > > I'm trying to understand why I cannot read my CD drive directly from a > 'c' program using the read(2) system call, or even using the dd(1) > command. As you will see, I have both the acd0 and cd0 devices since > I have atapicam configured in the kernel. > > I can mount cdrom media using mount() and access data via the cd9660 > file system, so I know the drive and the media are not the problem. > > #dd if=/dev/acd0 of=/dev/null count=20 > dd: /dev/acd0: Invalid argument > 0+0 records in > 0+0 records out > 0 bytes transferred in 0.000163 secs (0 bytes/sec) > > #dd if=/dev/cd0 of=/dev/null count=20 > dd: /dev/cd0: Invalid argument > 0+0 records in > 0+0 records out > 0 bytes transferred in 0.000179 secs (0 bytes/sec) You have to define the sector size explicitly, otherwise your read(2)s will fail. You can use a multiple of 2048. dd uses by default a 512 byte length buffer. root:0:~# dd if=/dev/acd0 bs=2048 count=10 of=/dev/null 10+0 records in 10+0 records out 20480 bytes transferred in 4.110981 secs (4982 bytes/sec) That's for the so-called "data" CDs, the block size you have to use for audio CDs is 2352. HTH, Nikos