aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-01-04 13:34:02 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-01-04 13:34:02 +0000
commit6122ba93cf957bd495fdd1838bac16fb24896a17 (patch)
treeb8cef2eb41161e5beb7523f30b54ac03dfd7e9b4
parent1e1cf2c499d7ac0cfae536e1264af4645350813b (diff)
downloadlufa-6122ba93cf957bd495fdd1838bac16fb24896a17.tar.gz
lufa-6122ba93cf957bd495fdd1838bac16fb24896a17.tar.bz2
lufa-6122ba93cf957bd495fdd1838bac16fb24896a17.zip
Fix MassStorageKeyboard demo USE_INTERNAL_SERIAL check being performed before the required library headers were included, causing a compilation error.
Added notes to the class driver functions indicating which functions require what Device/Host state machine states to function.
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c16
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/makefile4
-rw-r--r--LUFA/Drivers/USB/Class/Device/Audio.h6
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.h18
-rw-r--r--LUFA/Drivers/USB/Class/Device/HID.c6
-rw-r--r--LUFA/Drivers/USB/Class/Device/HID.h7
-rw-r--r--LUFA/Drivers/USB/Class/Device/MIDI.h6
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.h15
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.c3
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.h12
-rw-r--r--LUFA/Drivers/USB/Class/Host/MIDI.h6
-rw-r--r--LUFA/Drivers/USB/Class/Host/MassStorage.h18
-rw-r--r--LUFA/Drivers/USB/Class/Host/Printer.h3
-rw-r--r--LUFA/Drivers/USB/Class/Host/RNDIS.h9
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.h38
-rw-r--r--LUFA/ManPages/LUFAPoweredProjects.txt5
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskHost.c6
17 files changed, 159 insertions, 19 deletions
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
index b779ea342..d3e4214fa 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
@@ -29,10 +29,6 @@
this software.
*/
-#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
- #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
-#endif
-
/** \file
*
* USB Device Descriptors, for library use when in USB device mode. Descriptors are special
@@ -42,6 +38,18 @@
#include "Descriptors.h"
+/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as
+ * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL.
+ * This allows the host to track a device across insertions on different ports, allowing them to retain allocated
+ * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices
+ * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value
+ * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and
+ * port location).
+ */
+#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR)
+ #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor.
+#endif
+
/** HID class report descriptor. This is a special descriptor constructed with values from the
* USBIF HID class specification to describe the reports and capabilities of the HID device. This
* descriptor is parsed by the host and its contents used to determine what data (and in what encoding)
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/makefile b/Demos/Device/ClassDriver/MassStorageKeyboard/makefile
index 30efdea40..3fc8293e9 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/makefile
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/makefile
@@ -123,8 +123,7 @@ LUFA_PATH = ../../../..
# LUFA library compile-time options
-LUFA_OPTS = -D USE_NONSTANDARD_DESCRIPTOR_NAMES
-LUFA_OPTS += -D USB_DEVICE_ONLY
+LUFA_OPTS = -D USB_DEVICE_ONLY
LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
@@ -132,6 +131,7 @@ LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENAB
LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT
+
# List C source files here. (C dependencies are automatically generated.)
SRC = $(TARGET).c \
Descriptors.c \
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.h b/LUFA/Drivers/USB/Class/Device/Audio.h
index fcfd65d72..e516b7101 100644
--- a/LUFA/Drivers/USB/Class/Device/Audio.h
+++ b/LUFA/Drivers/USB/Class/Device/Audio.h
@@ -123,6 +123,9 @@
/** Determines if the given audio interface is ready for a sample to be read from it, and selects the streaming
* OUT endpoint ready for reading.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state
*
* \return Boolean true if the given Audio interface has a sample to be read, false otherwise
@@ -132,6 +135,9 @@
/** Determines if the given audio interface is ready to accept the next sample to be written to it, and selects
* the streaming IN endpoint ready for writing.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state
*
* \return Boolean true if the given Audio interface is ready to accept the next sample, false otherwise
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h
index fb64d9e42..30d3526b3 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.h
+++ b/LUFA/Drivers/USB/Class/Device/CDC.h
@@ -157,6 +157,9 @@
/** Sends a given string to the attached USB host, if connected. If a host is not connected when the function is called, the
* string is discarded.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
* \param[in] Data Pointer to the string to send to the host
* \param[in] Length Size in bytes of the string to send to the host
@@ -169,6 +172,9 @@
/** Sends a given byte to the attached USB host, if connected. If a host is not connected when the function is called, the
* byte is discarded.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
* \param[in] Data Byte of data to send to the host
*
@@ -178,6 +184,9 @@
/** Determines the number of bytes received by the CDC interface from the host, waiting to be read.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
*
* \return Total number of buffered bytes received from the host
@@ -188,6 +197,9 @@
* returns 0. The \ref CDC_Device_BytesReceived() function should be queried before data is received to ensure that no data
* underflow occurs.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
*
* \return Next received byte from the host, or 0 if no data received
@@ -196,6 +208,9 @@
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
*
* \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum
@@ -207,6 +222,9 @@
* until they are cleared via a second notification. This should be called each time the CDC class driver's
* ControlLineStates.DeviceToHost value is updated to push the new states to the USB host.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state
*/
void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c
index 1c638bcb1..a5c03f726 100644
--- a/LUFA/Drivers/USB/Class/Device/HID.c
+++ b/LUFA/Drivers/USB/Class/Device/HID.c
@@ -186,10 +186,4 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
}
}
-void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo)
-{
- if (HIDInterfaceInfo->State.IdleMSRemaining)
- HIDInterfaceInfo->State.IdleMSRemaining--;
-}
-
#endif
diff --git a/LUFA/Drivers/USB/Class/Device/HID.h b/LUFA/Drivers/USB/Class/Device/HID.h
index fcea5aec0..14a5ff601 100644
--- a/LUFA/Drivers/USB/Class/Device/HID.h
+++ b/LUFA/Drivers/USB/Class/Device/HID.h
@@ -138,7 +138,12 @@
*
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state
*/
- void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
+ static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo);
+ static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* HIDInterfaceInfo)
+ {
+ if (HIDInterfaceInfo->State.IdleMSRemaining)
+ HIDInterfaceInfo->State.IdleMSRemaining--;
+ }
/** HID class driver callback for the user creation of a HID IN report. This callback may fire in response to either
* HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback the
diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.h b/LUFA/Drivers/USB/Class/Device/MIDI.h
index bccaa2037..3899f6e71 100644
--- a/LUFA/Drivers/USB/Class/Device/MIDI.h
+++ b/LUFA/Drivers/USB/Class/Device/MIDI.h
@@ -113,6 +113,9 @@
/** Sends a MIDI event packet to the host. If no host is connected, the event packet is discarded.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state
* \param[in] Event Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send
*
@@ -123,6 +126,9 @@
/** Receives a MIDI event packet from the host.
*
+ * \note This function must only be called when the Device state machine is in the DEVICE_STATE_Configured state or
+ * the call will fail.
+ *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state
* \param[out] Event Pointer to a USB_MIDI_EventPacket_t structure where the received MIDI event is to be placed
*
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h
index d2e98c0fa..20ee3209e 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.h
+++ b/LUFA/Drivers/USB/Class/Host/CDC.h
@@ -177,6 +177,9 @@
/** Sends a given string to the attached USB device, if connected. If a device is not connected when the function is called, the
* string is discarded.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state
* \param[in] Data Pointer to the string to send to the device
* \param[in] Length Size in bytes of the string to send to the device
@@ -189,6 +192,9 @@
/** Sends a given byte to the attached USB device, if connected. If a host is not connected when the function is called, the
* byte is discarded.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state
* \param[in] Data Byte of data to send to the device
*
@@ -198,6 +204,9 @@
/** Determines the number of bytes received by the CDC interface from the device, waiting to be read.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state
*
* \return Total number of buffered bytes received from the device
@@ -208,6 +217,9 @@
* returns 0. The \ref CDC_Host_BytesReceived() function should be queried before data is received to ensure that no data
* underflow occurs.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state
*
* \return Next received byte from the device, or 0 if no data received
@@ -216,6 +228,9 @@
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state
*
* \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c
index 010b27b7a..e297ee5a7 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.c
+++ b/LUFA/Drivers/USB/Class/Host/HID.c
@@ -220,6 +220,9 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
void* Buffer, const uint16_t ReportSize)
{
#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)
+ if ((USB_HostState != HOST_STATE_Configured) || !(HIDInterfaceInfo->State.IsActive))
+ return false;
+
if (HIDInterfaceInfo->State.DeviceUsesOUTPipe)
{
uint8_t ErrorCode;
diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h
index 01174c536..72478c2e6 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.h
+++ b/LUFA/Drivers/USB/Class/Host/HID.h
@@ -159,6 +159,9 @@
/** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \note The destination buffer should be large enough to accommodate the largest report that the attached device
* can generate.
*
@@ -173,6 +176,9 @@
#if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)
/** Receives a HID IN report from the attached device, by the report ID.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.
*
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state
@@ -188,6 +194,9 @@
/** Sends an OUT report to the currently attached HID device, using the device's OUT pipe if available or the device's
* Control pipe if not.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, the ReportID parameter is removed
* from the parameter list of this function.
*
@@ -212,6 +221,9 @@
/** Determines if a HID IN report has been received from the attached device on the data IN pipe.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class host configuration and state
*
* \return Boolean true if a report has been received, false otherwise
diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.h b/LUFA/Drivers/USB/Class/Host/MIDI.h
index 31b79912f..2a64dc099 100644
--- a/LUFA/Drivers/USB/Class/Host/MIDI.h
+++ b/LUFA/Drivers/USB/Class/Host/MIDI.h
@@ -121,6 +121,9 @@
/** Sends a MIDI event packet to the device. If no device is connected, the event packet is discarded.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state
* \param[in] Event Pointer to a populated USB_MIDI_EventPacket_t structure containing the MIDI event to send
*
@@ -131,6 +134,9 @@
/** Receives a MIDI event packet from the device.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state
* \param[out] Event Pointer to a USB_MIDI_EventPacket_t structure where the received MIDI event is to be placed
*
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.h b/LUFA/Drivers/USB/Class/Host/MassStorage.h
index c6ca67c3f..7c304097b 100644
--- a/LUFA/Drivers/USB/Class/Host/MassStorage.h
+++ b/LUFA/Drivers/USB/Class/Host/MassStorage.h
@@ -164,6 +164,9 @@
/** Retrieves the Mass Storage device's inquiry data for the specified LUN, indicating the device characteristics and
* properties.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[out] InquiryData Location where the read inquiry data should be stored
@@ -186,6 +189,9 @@
/** Retrieves the total capacity of the attached USB Mass Storage device, in blocks, and block size.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[out] DeviceCapacity Pointer to the location where the capacity information should be stored
@@ -199,6 +205,9 @@
/** Retrieves the device sense data, indicating the current device state and error codes for the previously
* issued command.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[out] SenseData Pointer to the location where the sense information should be stored
@@ -212,6 +221,9 @@
/** Issues a PREVENT MEDIUM REMOVAL command, to logically (or, depending on the type of device, physically) lock
* the device from removal so that blocks of data on the medium can be read or altered.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[in] PreventRemoval Boolean true if the device should be locked from removal, false otherwise
@@ -223,6 +235,9 @@
/** Reads blocks of data from the attached Mass Storage device's medium.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[in] BlockAddress Starting block address within the device to read from
@@ -238,6 +253,9 @@
/** Writes blocks of data to the attached Mass Storage device's medium.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a MS Class host configuration and state
* \param[in] LUNIndex LUN index within the device the command is being issued to
* \param[in] BlockAddress Starting block address within the device to write to
diff --git a/LUFA/Drivers/USB/Class/Host/Printer.h b/LUFA/Drivers/USB/Class/Host/Printer.h
index b7a1ae7a3..c424dafab 100644
--- a/LUFA/Drivers/USB/Class/Host/Printer.h
+++ b/LUFA/Drivers/USB/Class/Host/Printer.h
@@ -156,6 +156,9 @@
* printer is able to understand - for example, PCL data. Not all printers accept all printer languages; see
* \ref PRNT_Host_GetDeviceID() for details on determining acceptable languages for an attached printer.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class host configuration and state
* \param[in] PrinterCommands Pointer to a buffer containing the raw command stream to send to the printer
* \param[in] CommandSize Size in bytes of the command stream to be sent
diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.h b/LUFA/Drivers/USB/Class/Host/RNDIS.h
index 827cd65a0..fad27b9ad 100644
--- a/LUFA/Drivers/USB/Class/Host/RNDIS.h
+++ b/LUFA/Drivers/USB/Class/Host/RNDIS.h
@@ -190,6 +190,9 @@
/** Determines if a packet is currently waiting for the host to read in and process.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state
*
* \return Boolean true if a packet is waiting to be read in by the host, false otherwise
@@ -200,6 +203,9 @@
/** Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave
* only the packet contents for processing by the host in the nominated buffer.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state
* \param[out] Buffer Pointer to a buffer where the packer data is to be written to
* \param[out] PacketLength Pointer to where the length in bytes of the read packet is to be stored
@@ -211,6 +217,9 @@
/** Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class host configuration and state
* \param[in] Buffer Pointer to a buffer where the packer data is to be read from
* \param[in] PacketLength Length in bytes of the packet to send
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h
index 5dec6f06b..9b655967f 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.h
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.h
@@ -134,7 +134,10 @@
/** Opens a new PIMA session with the attached device. This should be used before any session-orientated PIMA commands
* are issued to the device. Only one session can be open at the one time.
- *
+ *
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
@@ -144,7 +147,10 @@
/** Closes an already opened PIMA session with the attached device. This should be used after all session-orientated
* PIMA commands have been issued to the device.
- *
+ *
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
@@ -155,6 +161,9 @@
/** Sends a raw PIMA block header to the device, filling out the transaction ID automatically. This can be used to send
* arbitrary PIMA blocks to the device with or without parameters.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[in] PIMAHeader Pointer to a PIMA container structure that is to be sent
*
@@ -165,6 +174,9 @@
/** Receives a raw PIMA block header to the device. This can be used to receive arbitrary PIMA blocks from the device with
* or without parameters.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[out] PIMAHeader Pointer to a PIMA container structure where the received block is to be stored
*
@@ -173,7 +185,10 @@
uint8_t SImage_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, SI_PIMA_Container_t* const PIMAHeader);
/** Sends a given PIMA command to the attached device, filling out the PIMA command header's Transaction ID automatically.
- *
+ *
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[in] Operation PIMA operation code to issue to the device
* \param[in] TotalParams Total number of 32-bit parameters to send to the device in the issued command block
@@ -187,7 +202,10 @@
/** Receives and checks a response block from the attached PIMA device, once a command has been issued and all data
* associated with the command has been transferred.
- *
+ *
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
@@ -197,6 +215,9 @@
/** Indicates if the device has issued a PIMA event block to the host via the asynchronous events pipe.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
*
* \return Boolean true if an event is waiting to be read, false otherwise
@@ -205,6 +226,9 @@
/** Receives an asynchronous event block from the device via the asynchronous events pipe.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[out] PIMAHeader Pointer to a PIMA container structure where the event should be stored
*
@@ -218,6 +242,9 @@
/** Sends arbitrary data to the attached device, for use in the data phase of PIMA commands which require data
* transfer beyond the regular PIMA command block parameters.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[in] Buffer Pointer to a buffer where the data to send has been stored
* \param[in] Bytes Length in bytes of the data in the buffer to send to the attached device
@@ -230,6 +257,9 @@
/** Receives arbitrary data from the attached device, for use in the data phase of PIMA commands which require data
* transfer beyond the regular PIMA command block parameters.
*
+ * \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
+ * call will fail.
+ *
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
* \param[out] Buffer Pointer to a buffer where the received data is to be stored
* \param[in] Bytes Length in bytes of the data to read
diff --git a/LUFA/ManPages/LUFAPoweredProjects.txt b/LUFA/ManPages/LUFAPoweredProjects.txt
index df31db8e9..f07750f95 100644
--- a/LUFA/ManPages/LUFAPoweredProjects.txt
+++ b/LUFA/ManPages/LUFAPoweredProjects.txt
@@ -18,6 +18,7 @@
* The following is a list of known AVR USB development boards, which recommend using LUFA for the USB stack. Some of these
* are open design, and all are available for purchase as completed development boards suitable for project development.
*
+ * - AT90USB162 Breadboard PCB (Russian): http://microsin.ru/content/view/685/44/
* - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/wiki/benito
* - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/bumble-b
* - Micropendous, an open design/source set of AVR USB development boards: http://micropendous.org/
@@ -64,4 +65,8 @@
* - Lightweight CC110x USB dongle for 868MHz Protocols: http://busware.de/tiki-index.php?page=CUL
* - Mobo 4.3, a USB controlled all band (160-10m) HF SDR transceiver: http://sites.google.com/site/lofturj/mobo4_3
* - SEGA Megadrive/Super Nintendo Cartridge Reader: http://www.snega2usb.com
+ *
+ * \section Sec_LUFAPublications Publications Mentioning LUFA
+ * - Elektor Magazine, "My First AVR-USB" by Antoine Authier (feature), January 2010 Issue
+ * - Elektor Magazine, "USB is Cool/Sucks" by Jerry Jacobs and Chris Vossen (minor mention), January 2010 Issue
*/ \ No newline at end of file
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskHost.c b/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
index ef69df2c6..e50fc30af 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
@@ -79,8 +79,6 @@ void DiskHost_USBTask(void)
return;
}
- USB_HostState = HOST_STATE_Configured;
-
uint8_t MaxLUNIndex;
if (MS_Host_GetMaxLUN(&DiskHost_MS_Interface, &MaxLUNIndex))
{
@@ -96,6 +94,10 @@ void DiskHost_USBTask(void)
return;
}
+ USB_HostState = HOST_STATE_Configured;
+
+ /* Note: For the RequestSense call to work, the host state machine must be in the
+ * Configured state, or the call will be aborted */
SCSI_Request_Sense_Response_t SenseData;
if (MS_Host_RequestSense(&DiskHost_MS_Interface, 0, &SenseData) != 0)
{