SG_GET_CONFIG(8)

πŸ“¦
version 1.49 Β· 4 versions
, in alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

okay bestie, the manual name is SG3_UTILS and this page is all about sg_get_config, which sends a SCSI GET CONFIGURATION command (MMC-4 +) πŸŽ€βœ¨

🧚 SYNOPSIS 🧚

sg_get_config [--brief] [--current] [--help] [--hex] [--inner-hex]
[--list] [--raw] [--readonly] [--rt=RT] [--starting=FC] [--verbose]
[--version] DEVICE

🌸 DESCRIPTION 🌸

okay so this one sends a SCSI GET CONFIGURATION command to DEVICE and then decodes the response for you πŸ’… The response tells you all about the device's features and profiles πŸ”₯ The devices this is usually for are CD, DVD, HD-DVD and BD players, and they may (but not necessarily) have media in them πŸ’Ώ They might be connected over ATAPI, USB or IEEE 1394, and in those cases they only count as "SCSI" devices because they speak the "Multi-Media command" set (MMC) πŸ¦‹ MMC is a specialised SCSI command set, and you can find its definition at https://www.t10.org 🫢

This utility is based on the MMC-4 and later draft standards πŸ“š For more on specific feature parameters and profiles, check section 5 on "Features and Profile for Multi_Media devices" ✨ The manufacturer's product manual might be useful too, lowkey πŸ’œ

ngl the output can get huge because modern DVD and BD writers support loads of features and profiles 😭 Here's how to cut it down:

  • If you use --brief, you only get the feature names and the feature parameters don't get decoded πŸ“
  • If only one feature is interesting to you, try this combo: "--rt=2 --starting=FC" πŸŽ€
  • Want only the features that match the media in the drive (aka "current")? Use the "--rt=1" option 🌈

πŸ‘‘ OPTIONS πŸ‘‘

Arguments to long options are mandatory for short options as well, so don't forget them πŸ’–

  • -b, --brief β€” shows the feature names but skips decoding their parameters πŸ“ When paired with --list, it shows the known feature names but not the known profile names.
  • -c, --current β€” outputs the features marked as current πŸ’… This is the same as '--rt=1'.
  • -h, --help β€” prints the usage message and then exits πŸ™ˆ
  • -H, --hex β€” outputs the response in hex, no decoding πŸ”₯
  • -i, --inner-hex β€” decodes down to the feature name level, then outputs each feature's data in hex ✨
  • -l, --list β€” lists every known feature and profile name, and ignores the device name if you gave one 🧚 You get the feature names and profiles (followed by their hex values) that this utility knows about. If you also add --brief, you only get the feature names.
  • -q, --readonly β€” opens DEVICE read-only instead of the default read-write 🫢 The Linux sg driver needs read-write access for the SCSI GET CONFIGURATION command, but other access methods might need read-only.
  • -r, --rt=RT β€” RT is the field with that name in the GET CONFIGURATION cdb πŸ’œ Valid values are 0, 1, 2, or 3 . What the command does also depends on the --starting=FC option, and the default is 0.
    • With RT 0, you get all features whether or not they're current, as long as their feature code is greater than or equal to FC given to --starting=.
    • With RT 1, you get all current features whose feature code is greater than or equal to FC.
    • With RT 2, you get the feature whose feature code is equal to FC, if there is one.
    • With RT 3, the response is reserved, so you'll probably get an "illegal field in cdb" error 😭

To make the RT values easier to remember:

0 : all features, current on not
1 : only current features
2 : only feature whose code is FC
3 : reserved
  • -R, --raw β€” outputs the response in binary to stdout πŸ¦‹ Heads up: the short form is -R, not -r, unlike most other utilities in this package that use -r for this action πŸ’€
  • -s, --starting=FC β€” FC is the feature code value 🌸 This option works closely with --rt=RT. FC can be in the range 0 to 65535 (0xffff) inclusive, and its default is 0. A value prefixed with "0x" (or a trailing 'h') is read as hexadecimal ✨
  • -v, --verbose β€” cranks up the verbosity, aka the debug output πŸ”₯
  • -V, --version β€” prints the version string and then exits πŸ’…

πŸ¦‹ NOTES πŸ¦‹

okay this part is a history lesson but it's actually important πŸ“š There are multiple versions of the MMC (draft) standards: MMC [1997], MMC-2 [2000], MMC-3 [2002], MMC-4 and MMC-5 🌈 The first three are now ANSI INCITS standards, and the year they became standards is shown in brackets. The draft right before standardisation is at https://www.t10.org ✨

The initial MMC standard had no GET CONFIGURATION command, so the info came from the "CD capabilities and mechanical status mode page" (mode page 0x2a) πŸ’œ That got renamed to the "MM capabilities and mechanical status mode page" and was made obsolete in MMC-4 and MMC-5 πŸ₯Ί The GET CONFIGURATION command arrived in MMC-2 and replaced that mode page 🫢 New stuff like support for "BD" (blue ray) media types can only be found with GET CONFIGURATION, so older CD players might not support it 😭 If that's the case, check the "MM capabilities ..." mode page with sdparm(8), sginfo(8) or sg_modes(8) πŸŽ€

In the 2.4 series of Linux kernels, DEVICE must be a SCSI generic (sg) device πŸ’– In the 2.6 series, block devices can be specified too. For example, "sg_get_config /dev/hdc" works on 2.6 series kernels as long as /dev/hdc is an ATAPI device ✨ Also in the 2.6 series, external DVD writers attached via USB can be queried with something like "sg_get_config /dev/scd1" 🧚

πŸŽ€ EXIT STATUS πŸŽ€

The exit status of sg_get_config is 0 when it succeeds πŸ’… Otherwise, see the sg3_utils(8) man page πŸ”₯

🫢 AUTHORS 🫢

Written by Douglas Gilbert πŸ’œ

πŸ™ˆ REPORTING BUGS πŸ™ˆ

Report bugs to <dgilbert at interlog dot com> πŸ›

Copyright Β© 2004-2012 Douglas Gilbert πŸ¦‹ This software is distributed under a BSD-2-Clause license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE πŸ’€

πŸ“ SEE ALSO πŸ“

sginfo(8), sg_modes(8), sg_inq(8), sg_prevent(8), sg_start(8) [all in sg3_utils], sdparm(8) ✨


okay bestie that's the whole page, it's from sg3_utils-1.35, December 2012, and it's the SG_GET_CONFIG(8) page πŸ’–πŸ§šβœ¨

πŸ“¦ where this page comes from