How does in linux the scsi generic (sg) driver choose low-level driver(sd or sr) to use. I've found that the sg driver gets type of device from inquiry command.
sdev->type = (inq_result[0] & 0x1f);
After that "scsi_sysfs_add_sdev" function is called. And I doesn't see any using of field "->type" in this function.