Re: [PATCH] hdparm: fix printing of ATA identification strings

tito via busybox <[email protected]>
Newsgroups gmane.linux.busybox
Message-ID <20260812000611.19b4754f@devuan>
On Tue, 11 Aug 2026 11:33:24 +0200
"Roberto A. Foglietta" <[email protected]> wrote:

> On Tue, 11 Aug 2026 at 11:18, Roberto A. Foglietta
> <[email protected]> wrote:
> >
> > On Tue, 11 Aug 2026 at 10:20, tito via busybox <[email protected]> wrote:
> > >
> > > On Tue, 11 Aug 2026 14:22:58 +0900
> > > Romain Guyard via busybox <[email protected]> wrote:
> > >
> > > > Hello!
> > > >
> > > > In the hdparm applet, print_ascii() is intended to skip leading
> > > > spaces before printing ATA IDENTIFY strings, but its condition
> > > > is inverted, causing it to skip non-space characters instead.
> > > >
> > > > This causes left-justified serial numbers and firmware revisions to be
> > > > printed as empty, and truncates model strings at their first embedded
> > > > space.
> > > >
> > > > The attached patch fixes the condition and adds a regression test using
> > > > synthetic ATA IDENTIFY data. It was also tested on real hardware.
> > > >
> > > > Thanks,
> > > Hi,
> > > to be honest the hdparm applet seems to be totally broken
> > > with latest git:
> >
> > Please, try without this:
> >
> > + 36eed984b - 2026-02-04 - fdisk: several fixes for 4K sector size
> >
> 
> Whatever that commit or the previous ones, on Linux 6.8 (Ubuntu) the
> result is always the same (while the GNU counter part does something
> more):
> 
> roberto@x280[2]:~/robang74/busybox$ sudo ./busybox hdparm -Ii /dev/sda
> 
> /dev/sda:
> hdparm: ioctl 0x304 failed: Invalid argument
> hdparm: HDIO_GET_IDENTITY: Invalid argument
> hdparm: HDIO_DRIVE_CMD: Invalid argument
> 
> roberto@x280[2]:~/robang74/busybox$ sudo  hdparm -Ii /dev/sda
> 
> /dev/sda:
>  HDIO_GET_IDENTITY failed: Invalid argument
> 
> ATA device, with non-removable media
> 
> Best regards,

Hi,
I suspect that it is just the missing of capability to issue the  ATA  commands pass through via SG_IO (see hdparm 9.65 source)
because for me some HDDs (attached to motherboard sata ports)  work and others (attached to LSI HBA CARDS) don't.
This cannot be fixed without major code changes that I don't feel comfortable to do.

Ciao,
Tito
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.