diff options
author | Peter Chubb <peterc@gelato.unsw.edu.au> | 2006-05-02 13:29:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 18:04:10 -0400 |
commit | bdcfd9e349eff9398a1d85eaa517294f493bb3c8 (patch) | |
tree | 62a8804e6ff6559a0de1f09021c9f8cccaf11cf5 /drivers/usb/storage/shuttle_usbat.c | |
parent | 141804d401631f0384feabfa5fc3e2ce1321c0f0 (diff) |
[PATCH] USB: shuttle_usbat: Hardcode detection of HP CDRW devices
Use USB vendor and product IDs to determine whether the attached
device is a CDROM or a Flash device. Daniel Drake says that the
*same* vendor and product IDs for non-HP vendor ID could be either
flash or cdrom, so try to probe for them.
Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au>
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage/shuttle_usbat.c')
-rw-r--r-- | drivers/usb/storage/shuttle_usbat.c | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c index 92095b858eb7..8fcec01dc622 100644 --- a/drivers/usb/storage/shuttle_usbat.c +++ b/drivers/usb/storage/shuttle_usbat.c | |||
@@ -893,22 +893,28 @@ static int usbat_identify_device(struct us_data *us, | |||
893 | * Set the transport function based on the device type | 893 | * Set the transport function based on the device type |
894 | */ | 894 | */ |
895 | static int usbat_set_transport(struct us_data *us, | 895 | static int usbat_set_transport(struct us_data *us, |
896 | struct usbat_info *info) | 896 | struct usbat_info *info, |
897 | int devicetype) | ||
897 | { | 898 | { |
898 | int rc; | ||
899 | 899 | ||
900 | if (!info->devicetype) { | 900 | if (!info->devicetype) |
901 | rc = usbat_identify_device(us, info); | 901 | info->devicetype = devicetype; |
902 | if (rc != USB_STOR_TRANSPORT_GOOD) { | ||
903 | US_DEBUGP("usbat_set_transport: Could not identify device\n"); | ||
904 | return 1; | ||
905 | } | ||
906 | } | ||
907 | 902 | ||
908 | if (usbat_get_device_type(us) == USBAT_DEV_HP8200) | 903 | if (!info->devicetype) |
904 | usbat_identify_device(us, info); | ||
905 | |||
906 | switch (info->devicetype) { | ||
907 | default: | ||
908 | return USB_STOR_TRANSPORT_ERROR; | ||
909 | |||
910 | case USBAT_DEV_HP8200: | ||
909 | us->transport = usbat_hp8200e_transport; | 911 | us->transport = usbat_hp8200e_transport; |
910 | else if (usbat_get_device_type(us) == USBAT_DEV_FLASH) | 912 | break; |
913 | |||
914 | case USBAT_DEV_FLASH: | ||
911 | us->transport = usbat_flash_transport; | 915 | us->transport = usbat_flash_transport; |
916 | break; | ||
917 | } | ||
912 | 918 | ||
913 | return 0; | 919 | return 0; |
914 | } | 920 | } |
@@ -1316,7 +1322,7 @@ static int usbat_select_and_test_registers(struct us_data *us) | |||
1316 | /* | 1322 | /* |
1317 | * Initialize the USBAT processor and the storage device | 1323 | * Initialize the USBAT processor and the storage device |
1318 | */ | 1324 | */ |
1319 | int init_usbat(struct us_data *us) | 1325 | static int init_usbat(struct us_data *us, int devicetype) |
1320 | { | 1326 | { |
1321 | int rc; | 1327 | int rc; |
1322 | struct usbat_info *info; | 1328 | struct usbat_info *info; |
@@ -1398,7 +1404,7 @@ int init_usbat(struct us_data *us) | |||
1398 | US_DEBUGP("INIT 9\n"); | 1404 | US_DEBUGP("INIT 9\n"); |
1399 | 1405 | ||
1400 | /* At this point, we need to detect which device we are using */ | 1406 | /* At this point, we need to detect which device we are using */ |
1401 | if (usbat_set_transport(us, info)) | 1407 | if (usbat_set_transport(us, info, devicetype)) |
1402 | return USB_STOR_TRANSPORT_ERROR; | 1408 | return USB_STOR_TRANSPORT_ERROR; |
1403 | 1409 | ||
1404 | US_DEBUGP("INIT 10\n"); | 1410 | US_DEBUGP("INIT 10\n"); |
@@ -1701,6 +1707,22 @@ static int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us) | |||
1701 | return USB_STOR_TRANSPORT_FAILED; | 1707 | return USB_STOR_TRANSPORT_FAILED; |
1702 | } | 1708 | } |
1703 | 1709 | ||
1710 | int init_usbat_cd(struct us_data *us) | ||
1711 | { | ||
1712 | return init_usbat(us, USBAT_DEV_HP8200); | ||
1713 | } | ||
1714 | |||
1715 | |||
1716 | int init_usbat_flash(struct us_data *us) | ||
1717 | { | ||
1718 | return init_usbat(us, USBAT_DEV_FLASH); | ||
1719 | } | ||
1720 | |||
1721 | int init_usbat_probe(struct us_data *us) | ||
1722 | { | ||
1723 | return init_usbat(us, 0); | ||
1724 | } | ||
1725 | |||
1704 | /* | 1726 | /* |
1705 | * Default transport function. Attempts to detect which transport function | 1727 | * Default transport function. Attempts to detect which transport function |
1706 | * should be called, makes it the new default, and calls it. | 1728 | * should be called, makes it the new default, and calls it. |
@@ -1714,9 +1736,8 @@ int usbat_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1714 | { | 1736 | { |
1715 | struct usbat_info *info = (struct usbat_info*) (us->extra); | 1737 | struct usbat_info *info = (struct usbat_info*) (us->extra); |
1716 | 1738 | ||
1717 | if (usbat_set_transport(us, info)) | 1739 | if (usbat_set_transport(us, info, 0)) |
1718 | return USB_STOR_TRANSPORT_ERROR; | 1740 | return USB_STOR_TRANSPORT_ERROR; |
1719 | 1741 | ||
1720 | return us->transport(srb, us); | 1742 | return us->transport(srb, us); |
1721 | } | 1743 | } |
1722 | |||