/dev/sgxx is a SCSI-generic device, which allows sending and receiving of raw SCSI commands. When you write to the device, you are expected to start the write with a SCSI header, which defines the operation you wish to do.
Writing random data to an
sg device is really a bad idea. You'll be sending random SCSI commands, which might not even exist (hence
function not implemented) and furthermore giving a random byte length for the operation, which is highly likely to result in
cannot allocate memory. (If you're really unlucky, the random command might do something.)
Depending on what device you actually have connected to
/dev/sg11, you might want to investigate the
sg3_utils package, or some more specific SCSI device driver like
st (tape drives).
One of the useful utility commands which comes with the sg utils is
sg_map, which can let you know what the primary device corresponding to an sg device. On non-ancient Linux systems, you can also install
lsscsi which provides a nice listing of SCSI devices, again with both the /dev/sg device and the primary device.
sg3_utils also includes
sg_dd which is a version of
dd which understands the low-level SCSI protocol. (But only use it if you know what you're doing!)