hreinecke / sg3_utils

Deprecated git-svn mirror for sg3_utils
http://sg.danny.cz/sg/sg3_utils.html
Other
154 stars 91 forks source link

sg_write_attr #87

Closed borisfox73 closed 1 year ago

borisfox73 commented 1 year ago

Implemented sg_write_attr utility to set (writable) attributes in the SCSI device using SCSI WRITE ATTRIBUTE command.

doug-gilbert commented 1 year ago

Wow, I only just saw this. My most recent work is over at https://github.com/doug-gilbert/sg3_utils and I just pushed (mirrored) revision 992. So I have taken this patch and applied it to my subversion repo. Looks good ... plus documentation with examples! I have been busy adding JSON output to the main SPC utilities that decode significant amount of data (e.g. sg_vpd, sg_ses and sg_logs). I don't think that sg_read_attr would be my next utility to add JSON to. Would that be useful, in your opinion? I haven't spent much time thinking about whether having JSON as input to utilities like sg_write_attr would be a good idea (or practical).

When I push this out, it will (svn) revision 993 and the CREDITS file has an entry for you but no email address. If you want that added perhaps you could email your email address. First I want to try some of those examples on my Ultrium 5 drive which according to sg_opcodes supports the Write Attribute command. Thanks again.

doug-gilbert commented 1 year ago

Subversion revision 993 is now mirrored on my github site. and includes sg_write_attr . Changed some formatting, placated 'clang --analyze' and 'g++ -std=cpp20'. Perhaps you could check just in case I broke something.

borisfox73 commented 1 year ago

Hi Doug, Thanks for accepting this PR. My e-mail address is boris@borisfox.com.

I've checked setting and deleting every host type attribute from SPC-5 Clause 7.4.2.4 on my HP LTO-4 standalone drives (currenlty only have these), except: 080Ch VOLUME COHERENCY INFORMATION 0820h MEDIUM GLOBALLY UNIQUE IDENTIFIER 0821h MEDIA POOL GLOBALLY UNIQUE IDENTIFIER which these drives seems do not support.

JSON support might be useful for some (hypothetical) automation tools or API integration as more machine-friendly data interchange than arbitrary human-readable format currently used in these utilities. Data transfer objects specifications have to be elaborated, as well as error reporting.

daaazdddi commented 1 year ago

080Ch ,0820h and 0821h were added for LTFS support so LTO5 and above

hreinecke commented 1 year ago

Merged with git svn id 993.