linux-usb-gadgets / libusbgx

C library encapsulating the Linux kernel USB gadget configfs userspace API functionality
GNU General Public License v2.0
216 stars 72 forks source link

Add inquiry_string to LUN attributes #87

Closed NekoCWD closed 9 months ago

NekoCWD commented 9 months ago

Add "inquiry_string" to LUN attributes

What is inquiry_string in LUN attributes?

Inquiry string is a name of LUN which used in SCSI inquiry

For example:

Without inquiry_string (as now)

[timesnap] usb 1-9: new high-speed USB device number 22 using xhci_hcd
[timesnap] usb 1-9: New USB device found, idVendor=1d6b, idProduct=0104, bcdDevice= 0.01
[timesnap] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[timesnap] usb 1-9: Product: Bar Gadget
[timesnap] usb 1-9: Manufacturer: Foo Inc.
[timesnap] usb 1-9: SerialNumber: 0123456789
[timesnap] usb-storage 1-9:1.0: USB Mass Storage device detected
[timesnap] scsi host6: usb-storage 1-9:1.0
[timesnap] scsi 6:0:0:0: Direct-Access     Linux    File-Stor Gadget 0607 PQ: 0 ANSI: 2
[timesnap] scsi 6:0:0:1: CD-ROM            Linux    File-Stor Gadget 0607 PQ: 0 ANSI: 2

Without inquiry_string (after merging this PR)

[timesnap] usb 1-9: new high-speed USB device number 23 using xhci_hcd
[timesnap] usb 1-9: New USB device found, idVendor=1d6b, idProduct=0104, bcdDevice= 0.01
[timesnap] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[timesnap] usb 1-9: Product: Bar Gadget
[timesnap] usb 1-9: Manufacturer: Foo Inc.
[timesnap] usb 1-9: SerialNumber: 0123456789
[timesnap] usb-storage 1-9:1.0: USB Mass Storage device detected
[timesnap] scsi host6: usb-storage 1-9:1.0
[timesnap] scsi 6:0:0:0: Direct-Access     Non-empt y                     PQ: 0 ANSI: 2
[timesnap] scsi 6:0:0:1: CD-ROM            Empty                          PQ: 0 ANSI: 2

Solves: #86

pabs3 commented 9 months ago

No changes to cppcheck or scan-build output and looks like no ABI breakage.

This looks fine to me, but lets see if anyone else has any thoughts.

-- bye, pabs

https://bonedaddy.net/pabs3/

mgrzeschik commented 9 months ago

Looks good to me. Will you merge @pabs3 ?

pabs3 commented 9 months ago

@NekoCWD could you submit a PR for gt to add support for this too?

NekoCWD commented 9 months ago

@NekoCWD could you submit a PR for gt to add support for this too?

Shure, i'll do it