From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11219 invoked by alias); 29 Jun 2012 22:42:59 -0000 Received: (qmail 11209 invoked by uid 22791); 29 Jun 2012 22:42:57 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from elasmtp-galgo.atl.sa.earthlink.net (HELO elasmtp-galgo.atl.sa.earthlink.net) (209.86.89.61) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 29 Jun 2012 22:42:44 +0000 Received: from [71.80.46.196] (helo=[192.168.0.5]) by elasmtp-galgo.atl.sa.earthlink.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1Skjtk-00030J-3L; Fri, 29 Jun 2012 18:42:44 -0400 Message-ID: <4FEE2F62.6010001@mindspring.com> Date: Fri, 29 Jun 2012 22:42:00 -0000 From: Frank Pagliughi User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Lightning/1.0b2 Thunderbird/3.1.16 MIME-Version: 1.0 To: Ken Yee CC: ecos-discuss@ecos.sourceware.org References: <20120629091545.28040@web005.roc2.bluetie.com> In-Reply-To: <20120629091545.28040@web005.roc2.bluetie.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ELNK-Trace: 4d82f965df0f6dd9e3f977c6d1ea408f0a9da525759e26546038e3e7345ec5efff31354aacf206570cdf93a589ab4c3c350badd9bab72f9c350badd9bab72f9c X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] reading size and used space on compact flash (CF) card? X-SW-Source: 2012-06/txt/msg00066.txt.bz2 On 06/29/2012 09:15 AM, Ken Yee wrote: > ... > } else { > error = cyg_io_get_config(cf_handle,0,&cf_info,&len); // > //printf("cf get_config error: %i %i\n",error,-EINVAL); // should get -EINVAL??? > uint32_t block_size = cf_info.block_size; > uint32_t blocks_num = cf_info.blocks_num; > uint32_t phys_block_size = cf_info.phys_block_size; > bool is_connected = cf_info.connected; > > ... > But as mentioned in the code, it's returning crazy numbers in the 33MB range no matter what size CF card I install (I've tried 32MB and 128MB :-( > Is there any other official API to read the size of it or any other IDE devices? > You are not using the proper key when querying for the disk information. You need to use CYG_IO_GET_CONFIG_DISK_INFO (not zero) as in: error = cyg_io_get_config(cf_handle, CYG_IO_GET_CONFIG_DISK_INFO, &cf_info, &len); When you use the unrecognized key of zero, the function returns the error code -EINVAL because it doesn't recognize the query. With the proper query the function should return 0 for success. Frank -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss