{"id":2653,"date":"2018-01-19T21:54:09","date_gmt":"2018-01-19T12:54:09","guid":{"rendered":"https:\/\/www.naraeon.net\/?p=2653"},"modified":"2024-09-24T22:43:17","modified_gmt":"2024-09-24T13:43:17","slug":"identify-sata-devices","status":"publish","type":"post","link":"https:\/\/www.naraeon.net\/en\/identify-sata-devices\/","title":{"rendered":"Naraeon SSD Tools internals &#8211; 6. Identify SATA devices"},"content":{"rendered":"<p><strong>Necessity<\/strong><\/p>\n<p>Last time, I introduced ATAPI command standard,\u00a0<a href=\"http:\/\/www.t13.org\/Documents\/UploadedDocuments\/docs2013\/d2161r5-ATAATAPI_Command_Set_-_3.pdf\">ACS-3<\/a>. I said about some definitions and introduced how we can issue a command to SATA devices.<\/p>\n<p>In this time, we would see implementation to issue identify device command in Naraeon SSD Tools.<\/p>\n<p><strong>Identify (Identify device)<\/strong><\/p>\n<p>In <a href=\"https:\/\/www.naraeon.net\/en\/commandset-bufferinterpreter\/\">fourth<\/a>, I said about Identify command like this.<\/p>\n<blockquote><p>BIOS and device manager shows model name, firmware version, capacity using this command. We need this to get them.<\/p><\/blockquote>\n<p>In Naraeon SSD Tools, to know what the device is, issuing this command is mandatory. I said only four things above, but almost every information about device can be get with this command.<\/p>\n<p>It is super easy to issue this command. Empty PreviousTaskFile and data buffer, and set other like next list. (N\/A also means 0)<\/p>\n<ul>\n<li>AtaFlags of Passthrough structure:\u00a0ATA_FLAGS_DATA_IN<\/li>\n<li>CurrentTaskFile[0]: N\/A<\/li>\n<li>CurrentTaskFile[1]:\u00a0N\/A<\/li>\n<li>CurrentTaskFile[2]:\u00a0N\/A<\/li>\n<li>CurrentTaskFile[3]:\u00a0N\/A<\/li>\n<li>CurrentTaskFile[4]:\u00a0N\/A<\/li>\n<li>CurrentTaskFile[5]:\u00a0N\/A<\/li>\n<li>CurrentTaskFile[6]: 0xEC<\/li>\n<li>CurrentTaskFile[7]: N\/A<\/li>\n<\/ul>\n<p>If it is sent successfully, data buffer would have result. As I said in <a href=\"https:\/\/www.naraeon.net\/issue-command-to-sata-devices\/\">fifth<\/a>, though most of the things come out in little endian word unit, be careful with byte order of string. The result has so many things so I can&#8217;t explain all of them one by one. You can refer Table 45 of\u00a0<a href=\"http:\/\/www.t13.org\/Documents\/UploadedDocuments\/docs2013\/d2161r5-ATAATAPI_Command_Set_-_3.pdf\">ACS-3<\/a>. There&#8217;s 20 pages of explanation about the result. If you see earlier version than that, you wouldn&#8217;t found negotiated SATA speed part.<\/p>\n<p>In Naraeon SSD Tools, issuing Identify device command is implemented in\u00a0SetBufferAndIdentifyDevice function of\u00a0<a href=\"https:\/\/github.com\/ebangin127\/naraeon-ssd\/blob\/master\/trunk\/WindowsFileAPI\/CommandSet.ATA.pas\">TATACommandSet<\/a>. Details are explained above, so I wouldn&#8217;t repeat in code part.<\/p>\n<p>[snippet slug=identifydevice lang=pascal]<\/p>\n<p>Interpretation is done in BufferToIdentifyDeviceResult of\u00a0<a href=\"https:\/\/github.com\/ebangin127\/naraeon-ssd\/blob\/master\/trunk\/WindowsFileAPI\/BufferInterpreter.ATA.pas\">TATABufferInterpreter<\/a>.<\/p>\n<p>[snippet slug=buffertoidentifydeviceresult lang=pascal]<\/p>\n<p>Interpretation in normal little endian word is done like this.<\/p>\n<p>[snippet slug=getusersizeinkbfrombuffer lang=pascal]<\/p>\n<p>But as ATA string has different byte order, we need another example.<\/p>\n<p>[snippet slug=getmodelfrombuffer lang=pascal]<\/p>\n<p>We went through how to get basic information from SATA storages. I would talk about getting diagnostic information(SMART) next time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Necessity Last time, I introduced ATAPI command standard,\u00a0ACS-3. I said about some definitions and introduced how we can issue a command to SATA devices. In this time, we would see implementation to issue identify device command in Naraeon SSD Tools. Identify (Identify device) In fourth, I said about Identify command like this. BIOS and device [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[300],"tags":[306,304,59,58,307,305,303,302],"class_list":["post-2653","post","type-post","status-publish","format-standard","hentry","category-ssd-tool-internals","tag-ata","tag-ioctl","tag-nvm-express","tag-nvme","tag-sat","tag-sata","tag-windows","tag-302"],"translation":{"provider":"WPGlobus","version":"3.0.2","language":"en","enabled_languages":["kr","en"],"languages":{"kr":{"title":true,"content":true,"excerpt":false},"en":{"title":true,"content":true,"excerpt":false}}},"_links":{"self":[{"href":"https:\/\/www.naraeon.net\/en\/wp-json\/wp\/v2\/posts\/2653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.naraeon.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.naraeon.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.naraeon.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.naraeon.net\/en\/wp-json\/wp\/v2\/comments?post=2653"}],"version-history":[{"count":10,"href":"https:\/\/www.naraeon.net\/en\/wp-json\/wp\/v2\/posts\/2653\/revisions"}],"predecessor-version":[{"id":2696,"href":"https:\/\/www.naraeon.net\/en\/wp-json\/wp\/v2\/posts\/2653\/revisions\/2696"}],"wp:attachment":[{"href":"https:\/\/www.naraeon.net\/en\/wp-json\/wp\/v2\/media?parent=2653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.naraeon.net\/en\/wp-json\/wp\/v2\/categories?post=2653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.naraeon.net\/en\/wp-json\/wp\/v2\/tags?post=2653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}