linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* to /sys from /proc/ide/hd$v/identify
@ 2004-06-07 13:48 Pat LaVarre
  2004-06-07 13:54 ` Jeff Garzik
  0 siblings, 1 reply; 5+ messages in thread
From: Pat LaVarre @ 2004-06-07 13:48 UTC (permalink / raw)
  To: linux-ide

> List:       linux-kernel
> Subject:    [RFC][DOC] writing IDE driver guidelines
> From:       Bartlomiej Zolnierkiewicz <B.Z...()elk...>
> Date:       2004-05-15 17:23:50
> 
> Feedback is welcomed.
> ...
> general rules:
> ...
> - use linux-ide@vger.kernel.org mailing list
> ...
> PCI drivers:
> ...
> - /proc/ide/ interfaces are obsolete

Where do I now find the ATA op xEC/A1 "IDENTIFY" data that was
/proc/ide/hd$v/identify ?

$ uname -r
2.6.7-rc2
$
$ sudo cat /proc/ide/hda/identify | wc -w
    256
$ sudo cat /proc/ide/hdc/identify | wc -w
    256
$
$ sudo mount -t sysfs sysfs /sys
$ sudo find /sys -name '*id*' | less
$ find /sys/bus/ide | less
$

Pat LaVarre



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: to /sys from /proc/ide/hd$v/identify
  2004-06-07 13:48 to /sys from /proc/ide/hd$v/identify Pat LaVarre
@ 2004-06-07 13:54 ` Jeff Garzik
  2004-06-07 19:46   ` Pat LaVarre
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2004-06-07 13:54 UTC (permalink / raw)
  To: Pat LaVarre; +Cc: linux-ide

Pat LaVarre wrote:
>>List:       linux-kernel
>>Subject:    [RFC][DOC] writing IDE driver guidelines
>>From:       Bartlomiej Zolnierkiewicz <B.Z...()elk...>
>>Date:       2004-05-15 17:23:50
>>
>>Feedback is welcomed.
>>...
>>general rules:
>>...
>>- use linux-ide@vger.kernel.org mailing list
>>...
>>PCI drivers:
>>...
>>- /proc/ide/ interfaces are obsolete
> 
> 
> Where do I now find the ATA op xEC/A1 "IDENTIFY" data that was
> /proc/ide/hd$v/identify ?
> 
> $ uname -r
> 2.6.7-rc2
> $
> $ sudo cat /proc/ide/hda/identify | wc -w
>     256
> $ sudo cat /proc/ide/hdc/identify | wc -w
>     256
> $
> $ sudo mount -t sysfs sysfs /sys
> $ sudo find /sys -name '*id*' | less
> $ find /sys/bus/ide | less


Since IDE supports taskfile ioctl, you shouldn't need this in sysfs...

	Jeff



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: to /sys from /proc/ide/hd$v/identify
  2004-06-07 13:54 ` Jeff Garzik
@ 2004-06-07 19:46   ` Pat LaVarre
  2004-06-07 19:54     ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 5+ messages in thread
From: Pat LaVarre @ 2004-06-07 19:46 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-ide

>>> - /proc/ide/ interfaces are obsolete
>> Where do I now find the ATA op xEC/A1 "IDENTIFY" data that was
>> /proc/ide/hd$v/identify ?
>
> Since IDE supports taskfile ioctl, you shouldn't need this in sysfs...

Unless corrected, I will guess this answer means:

Forget about the ! CONFIG_IDE_TASK_IOCTL kernels, and then for the  
remaining kernels persuade Google to teach you ioctl  
HDIO_DRIVE_TASKFILE.

Pat LaVarre

P.S. Evidence as follows:

http://marc.theaimsgroup.com/?l=linux-ide&s=taskfile+ioctl
http://www.google.com/search?q=linux-ide+taskfile+ioctl
http://lxr.linux.no/ident?v=2.6.5&i=ide_taskfile_ioctl
http://lxr.linux.no/source/drivers/ide/ide.c?v=2.6.5#L1554

1548 #ifdef CONFIG_IDE_TASK_IOCTL
1549                 case HDIO_DRIVE_TASKFILE:
1550                         if (!capable(CAP_SYS_ADMIN) ||  
!capable(CAP_SYS_RAWIO))
1551                                 return -EACCES;
1552                         switch(drive->media) {
1553                                 case ide_disk:
1554                                         return  
ide_taskfile_ioctl(drive, cmd, arg);
1555                                 default:
1556                                         return -ENOMSG;
1557                         }

http://groups.google.com/groups?q=ioctl%20HDIO_DRIVE_TASKFILE

From: Jeff Garzik (jgarzik@pobox.com)
Subject: Re: "do ata" scsi command?
Newsgroups: mlist.linux.scsi
Date: 2003-05-16 09:00:27 PST
...
I don't like HDIO_DRIVE_TASKFILE in this case :) and here's why:
...
http://groups.google.com/groups? 
selm=linux.scsi.3EC509A1.10503%40pobox.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: to /sys from /proc/ide/hd$v/identify
  2004-06-07 19:46   ` Pat LaVarre
@ 2004-06-07 19:54     ` Bartlomiej Zolnierkiewicz
  2004-06-07 21:58       ` Pat LaVarre
  0 siblings, 1 reply; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2004-06-07 19:54 UTC (permalink / raw)
  To: Pat LaVarre, Jeff Garzik; +Cc: linux-ide

On Monday 07 of June 2004 21:46, Pat LaVarre wrote:
> >>> - /proc/ide/ interfaces are obsolete
> >>
> >> Where do I now find the ATA op xEC/A1 "IDENTIFY" data that was
> >> /proc/ide/hd$v/identify ?
> >
> > Since IDE supports taskfile ioctl, you shouldn't need this in sysfs...

There is also HDIO_GET_IDENTITY.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: to /sys from /proc/ide/hd$v/identify
  2004-06-07 19:54     ` Bartlomiej Zolnierkiewicz
@ 2004-06-07 21:58       ` Pat LaVarre
  0 siblings, 0 replies; 5+ messages in thread
From: Pat LaVarre @ 2004-06-07 21:58 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: Jeff Garzik, linux-ide

> > > - /proc/ide/ interfaces are obsolete
> > ...
> > Where do I now find the ATA op xEC/A1 "IDENTIFY" data that was
> > /proc/ide/hd$v/identify ?
> ...
> Since IDE supports taskfile ioctl,
> you shouldn't need this in sysfs...
> ...
> > Forget about the ! CONFIG_IDE_TASK_IOCTL
> > kernels, and then for the remaining kernels
> > persuade Google to teach you ioctl  
> > HDIO_DRIVE_TASKFILE.
> > ...
> > > There is also HDIO_GET_IDENTITY

Thanks for that ATA pass thru hint, I pursued it as follows.

ioctl HDIO_GET_IDENTITY maybe works here for my PATA /dev/hda and PATAPI
/dev/hdc, though not yet for my SATAPI /dev/scd0.

The bits of HDIO_GET_IDENTITY differ from those of
/proc/ide/hd$v/identify.  /proc was byte-swapping text and substituting
x20 SPACE for x00 NUL, or vice versa.

$ sudo cat /proc/ide/hdc/identify | x2c | hexdump -C >1
$ sudo ~/bin/ataid /dev/hdc | hexdump -C >2
$ diff 1 2
2,6c2,6
< 00000010  00 00 00 00 20 20 20 20  20 20 20 20 20 20 20 20  |....            |
< 00000020  20 20 20 20 20 20 20 20  00 00 00 00 00 00 4b 48  |        ......KH|
< 00000030  30 4b 20 20 20 20 4c 49  54 45 2d 4f 4e 20 43 4f  |0K    LITE-ON CO|
< 00000040  4d 42 4f 20 4c 54 43 2d  34 38 31 36 31 48 20 20  |MBO LTC-48161H  |
< 00000050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 00 00  |              ..|
---
> 00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
> 00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 48 4b  |..............HK|
> 00000030  4b 30 00 00 00 00 49 4c  45 54 4f 2d 20 4e 4f 43  |K0....ILETO- NOC|
> 00000040  42 4d 20 4f 54 4c 2d 43  38 34 36 31 48 31 00 00  |BM OTL-C8461H1..|
> 00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
$

Pat LaVarre

-----

There is no
http://marc.theaimsgroup.com/?l=linux-ide&s=HDIO_GET_IDENTITY

man -K HDIO_GET_IDENTITY
here yields only: man 2 ioctl_list

http://www.google.com/search?q=man+HDIO_GET_IDENTITY
suggests:
ioctl(int d, HDIO_GET_IDENTITY, struct hd_driveid *hd) 

http://groups.google.com/groups?q=ioctl+HDIO_GET_IDENTITY
suggests essentially the following code, root privilege required.

------ ataid.c

#include <fcntl.h>
#include <linux/hdreg.h>
#include <stdio.h>
#include <sys/ioctl.h>

static struct hd_driveid hddi;

int main(int argc, char* argv[])
{
	--argc; ++argv;
	if (0 < argc) {
		int fd = open(argv[0], O_NONBLOCK);
		if (0 <= fd) {
			int ii = ioctl(fd,HDIO_GET_IDENTITY, &hddi);
			if (ii == 0) {
				FILE * fi = stdout;
#if 0
				if (fwrite(&hddi, sizeof hddi, 1, fi) == 1) {
					return 0;
				}
#else
				unsigned char * uchars = (char *) &hddi;
				int ix = 0;
				for (ix = 0; ix < (int) sizeof hddi; ix += 2) {
					fputc(uchars[ix + 1], fi);
					fputc(uchars[ix + 0], fi);
				}
				return 0;
#endif
			}
		}
	}
	fprintf(stderr, "not\n");
	return -1;
}



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-06-07 21:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-07 13:48 to /sys from /proc/ide/hd$v/identify Pat LaVarre
2004-06-07 13:54 ` Jeff Garzik
2004-06-07 19:46   ` Pat LaVarre
2004-06-07 19:54     ` Bartlomiej Zolnierkiewicz
2004-06-07 21:58       ` Pat LaVarre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).