diff --git a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/CoreComponentControl.java b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/CoreComponentControl.java index 7c7b7fd182..2ada97d001 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/CoreComponentControl.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/CoreComponentControl.java @@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.corecomponentinterfaces; import java.util.Collection; import java.util.Iterator; +import java.util.Set; import java.util.logging.Level; import org.sleuthkit.autopsy.coreutils.Logger; import org.openide.util.Lookup; @@ -71,17 +72,47 @@ public class CoreComponentControl { /** * Closes all TopComponent windows that needed ({@link DataExplorer}, {@link DataResult}, and - * {@link DataContent}) + * {@link DataContent}). + * + * Note: The DataContent Top Component must be closed before the Directory Tree + * and Favorites Top Components. Otherwise a NullPointerException will be thrown + * from JFXPanel. */ public static void closeCoreWindows() { WindowManager wm = WindowManager.getDefault(); + Set modes = wm.getModes(); Iterator iter = wm.getModes().iterator(); + TopComponent directoryTree = null; + TopComponent favorites = null; + String tcName = ""; while (iter.hasNext()) { Mode mode = iter.next(); for (TopComponent tc : mode.getTopComponents()) { - tc.close(); + tcName = tc.getName(); + if (tcName == null) { + logger.log(Level.INFO, "tcName was null"); + tcName = ""; + } + switch (tcName) { + case "Directory Tree": + directoryTree = tc; + break; + case "Favorites": + favorites = tc; + break; + default: + tc.close(); + break; + } } } + + if (directoryTree != null) { + directoryTree.close(); + } + if (favorites != null) { + favorites.close(); + } } } diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentPanel.java index a825751e4c..d38b2e900c 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentPanel.java @@ -189,8 +189,7 @@ public class DataContentPanel extends javax.swing.JPanel implements DataContent, // let the user decide if we should stay with the current viewer int tabIndex = keepCurrentViewer ? currTabIndex : preferredViewerIndex; - // set the tab to the one the user wants, then set that viewer's node. - jTabbedPane1.setSelectedIndex(tabIndex); + UpdateWrapper dcv = viewers.get(tabIndex); // this is really only needed if no tabs were enabled if (jTabbedPane1.isEnabledAt(tabIndex) == false) { @@ -199,6 +198,9 @@ public class DataContentPanel extends javax.swing.JPanel implements DataContent, else { dcv.setNode(selectedNode); } + + // set the tab to the one the user wants, then set that viewer's node. + jTabbedPane1.setSelectedIndex(tabIndex); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerMedia.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerMedia.java index af1d14d312..dafffe9ab2 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerMedia.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerMedia.java @@ -128,19 +128,19 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo return; //prevent from loading twice if setNode() called mult. times } - resetComponent(); + lastFile = file; final Dimension dims = DataContentViewerMedia.this.getSize(); if (imagePanelInited && containsExt(file.getName(), IMAGES)) { imagePanel.showImageFx(file, dims); - this.switchPanels(false); + this.switchPanels(false); } else if (videoPanelInited && (containsExt(file.getName(), VIDEOS) || containsExt(file.getName(), AUDIOS))) { videoPanel.setupVideo(file, dims); switchPanels(true); } - lastFile = file; + } catch (Exception e) { logger.log(Level.SEVERE, "Exception while setting node", e); } @@ -182,8 +182,8 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo @Override public void resetComponent() { - videoPanel.reset(); - // @@@ Seems like we should also reset the image viewer... + // No need to reset the video panel. It resets itself when a node is + // set. lastFile = null; } diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.form b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.form index f05c64d887..5143a19b43 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.form +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.form @@ -1,6 +1,11 @@
+ + + + + @@ -11,35 +16,8 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java index 7e89f8f923..1fa8b72f5d 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java @@ -18,7 +18,6 @@ */ package org.sleuthkit.autopsy.corecomponents; -import java.awt.Component; import java.awt.Dimension; import java.io.IOException; import java.nio.file.Paths; @@ -41,7 +40,6 @@ import javafx.scene.control.Label; import javafx.scene.control.Slider; import javafx.scene.control.Tooltip; import javafx.scene.layout.BorderPane; -import static javafx.scene.layout.BorderPane.setAlignment; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; @@ -56,8 +54,8 @@ import static javafx.scene.media.MediaPlayer.Status.READY; import static javafx.scene.media.MediaPlayer.Status.STOPPED; import javafx.scene.media.MediaPlayerBuilder; import javafx.scene.media.MediaView; +import javafx.scene.text.Font; import javafx.util.Duration; -import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.SwingWorker; @@ -97,29 +95,28 @@ public class FXVideoPanel extends MediaViewVideoPanel { public FXVideoPanel() { fxInited = Installer.isJavaFxInited(); initComponents(); - customizeComponents(); + if (fxInited) { + setupFx(); + } } public JPanel getVideoPanel() { - return videoPanel; + return this; } - - public Component getVideoComponent() { - return videoComponent; - } - - private void customizeComponents() { - SwingUtilities.invokeLater(new Runnable() { + + private void setupFx() { + Platform.runLater(new Runnable() { @Override public void run() { - videoPanel.removeAll(); - videoPanel.setLayout(new BoxLayout(videoPanel, BoxLayout.Y_AXIS)); - videoPanel.setVisible(true); + videoComponent = new JFXPanel(); + mediaPane = new MediaPane(); + Scene fxScene = new Scene(mediaPane); + videoComponent.setScene(fxScene); - Platform.runLater(new Runnable() { + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - setupFx(); + add(videoComponent); } }); } @@ -128,12 +125,21 @@ public class FXVideoPanel extends MediaViewVideoPanel { @Override - synchronized void setupVideo(final AbstractFile file, final Dimension dims) { + void setupVideo(final AbstractFile file, final Dimension dims) { + if(file.equals(currentFile)) { + return; + } + if (!Case.isCaseOpen()) { + //handle in-between condition when case is being closed + //and an image was previously selected + return; + } + reset(); currentFile = file; final boolean deleted = file.isDirNameFlagSet(TskData.TSK_FS_NAME_FLAG_ENUM.UNALLOC); if (deleted) { mediaPane.setInfoLabelText("Playback of deleted videos is not supported, use an external player."); - videoPanel.removeAll(); + removeAll(); return; } @@ -148,24 +154,10 @@ public class FXVideoPanel extends MediaViewVideoPanel { ExtractMedia em = new ExtractMedia(currentFile, getJFile(currentFile)); em.execute(); + + mediaPane.setFit(dims); } - synchronized void setupFx() { - if(!fxInited) { - return; - } - videoComponent = new JFXPanel(); - mediaPane = new MediaPane(); - Scene fxScene = new Scene(mediaPane); - videoComponent.setScene(fxScene); - - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - videoPanel.add(videoComponent); - } - }); - } @Override @@ -205,32 +197,10 @@ public class FXVideoPanel extends MediaViewVideoPanel { // //GEN-BEGIN:initComponents private void initComponents() { - videoPanel = new javax.swing.JPanel(); - - javax.swing.GroupLayout videoPanelLayout = new javax.swing.GroupLayout(videoPanel); - videoPanel.setLayout(videoPanelLayout); - videoPanelLayout.setHorizontalGroup( - videoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 400, Short.MAX_VALUE) - ); - videoPanelLayout.setVerticalGroup( - videoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 300, Short.MAX_VALUE) - ); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(videoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(videoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - ); + setBackground(new java.awt.Color(0, 0, 0)); + setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS)); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel videoPanel; // End of variables declaration//GEN-END:variables @Override @@ -339,8 +309,11 @@ public class FXVideoPanel extends MediaViewVideoPanel { /** The container for the media video output. **/ private HBox mediaViewPane; + private VBox controlPanel; + private Slider progressSlider; private Button pauseButton; + private Button stopButton; private Label progressLabel; private Label infoLabel; private int totalHours; @@ -348,14 +321,35 @@ public class FXVideoPanel extends MediaViewVideoPanel { private int totalSeconds; private String durationFormat = "%02d:%02d:%02d/%02d:%02d:%02d "; - /** The Listener for MediaPlayer.onReady(). **/ - private final MediaPane.ReadyListener READY_LISTENER = new MediaPane.ReadyListener(); + /** The EventHandler for MediaPlayer.onReady(). **/ + private final ReadyListener READY_LISTENER = new ReadyListener(); - /** The Listener for MediaPlayer.onEndOfMedia(). **/ - private final MediaPane.EndOfMediaListener END_LISTENER = new MediaPane.EndOfMediaListener(); + /** The EventHandler for MediaPlayer.onEndOfMedia(). **/ + private final EndOfMediaListener END_LISTENER = new EndOfMediaListener(); - /** The Listener for the CurrentTime property of the MediaPlayer. **/ - private final MediaPane.TimeListener TIME_LISTENER = new MediaPane.TimeListener(); + /** The EventHandler for the CurrentTime property of the MediaPlayer. **/ + private final TimeListener TIME_LISTENER = new TimeListener(); + + /** The EventHandler for MediaPlayer.onPause and MediaPlayer.onStop. **/ + private final NotPlayListener NOT_PLAY_LISTENER = new NotPlayListener(); + + /** The EventHandler for MediaPlayer.onPlay. **/ + private final PlayListener PLAY_LISTENER = new PlayListener(); + + private static final String PLAY_TEXT = "►"; + + private static final String PAUSE_TEXT = "||"; + + private static final String STOP_TEXT = "X"; + + /** CSS-formatted skin for pauseButton when showing PLAY_TEXT. **/ + private static final String PLAY_STYLE = "-fx-text-fill: green;"; + + /** CSS-formatted skin for pauseButton when showing PAUSE_TEXT. **/ + private static final String PAUSE_STYLE = "-fx-font-weight: bolder;"; + + /** CSS-formatted skin for stopButton. **/ + private static final String STOP_STYLE = "-fx-text-fill: red; -fx-font-weight: bold;"; public MediaPane() { // Video Display @@ -367,22 +361,27 @@ public class FXVideoPanel extends MediaViewVideoPanel { setCenter(mediaViewPane); // Media Controls - VBox controlPanel = new VBox(); + controlPanel = new VBox(); mediaTools = new HBox(); mediaTools.setAlignment(Pos.CENTER); mediaTools.setPadding(new Insets(5, 10, 5, 10)); - pauseButton = new Button("►"); + pauseButton = new Button(PLAY_TEXT); + pauseButton.setStyle(PLAY_STYLE); + stopButton = new Button(STOP_TEXT); + stopButton.setStyle(STOP_STYLE); mediaTools.getChildren().add(pauseButton); - mediaTools.getChildren().add(new Label(" ")); + mediaTools.getChildren().add(new Label(" ")); + mediaTools.getChildren().add(stopButton); + mediaTools.getChildren().add(new Label(" ")); progressSlider = new Slider(); HBox.setHgrow(progressSlider,Priority.ALWAYS); progressSlider.setMinWidth(50); progressSlider.setMaxWidth(Double.MAX_VALUE); mediaTools.getChildren().add(progressSlider); progressLabel = new Label(); - progressLabel.setPrefWidth(130); - progressLabel.setMinWidth(50); + progressLabel.setPrefWidth(135); + progressLabel.setMinWidth(135); mediaTools.getChildren().add(progressLabel); controlPanel.getChildren().add(mediaTools); @@ -391,19 +390,17 @@ public class FXVideoPanel extends MediaViewVideoPanel { controlPanel.getChildren().add(infoLabel); setBottom(controlPanel); setProgressActionListeners(); - disableControls(true); } /** - * Setup the MediaPane for media playback. + * Setup the MediaPane for media playback. Run on the JavaFx Thread. + * * * @param mediaUri the URI of the media */ public void prepareMedia(String mediaUri) { - disableControls(true); mediaPlayer = createMediaPlayer(mediaUri); mediaView.setMediaPlayer(mediaPlayer); - disableControls(false); } /** @@ -412,13 +409,12 @@ public class FXVideoPanel extends MediaViewVideoPanel { */ public void reset() { if (mediaPlayer != null) { - if (mediaPlayer.getStatus() == MediaPlayer.Status.PLAYING ) { + if (mediaPlayer.getStatus() == Status.PLAYING) { mediaPlayer.stop(); } mediaPlayer = null; } - setInfoLabelText(""); - disableControls(true); + resetProgress(); } /** @@ -427,6 +423,7 @@ public class FXVideoPanel extends MediaViewVideoPanel { * @param text */ public void setInfoLabelText(final String text) { + logger.log(Level.INFO, "Setting Info Label Text: " + text); Platform.runLater(new Runnable() { @Override public void run() { @@ -435,6 +432,23 @@ public class FXVideoPanel extends MediaViewVideoPanel { }); } + /** + * Set the size of the MediaPane and it's components. + * + * @param dims the current dimensions of the DataContentViewer + */ + public void setFit(final Dimension dims) { + Platform.runLater(new Runnable() { + @Override + public void run() { + setPrefSize(dims.getWidth(), dims.getHeight()); + // Set the Video output to fit the size allocated for it. give an + // extra few px to ensure the info label will be shown + mediaView.setFitHeight(dims.getHeight() - controlPanel.getHeight()); + } + }); + } + /** * Set the action listeners for the pause button and progress slider. */ @@ -447,31 +461,31 @@ public class FXVideoPanel extends MediaViewVideoPanel { switch (status) { // If playing, pause case PLAYING: - pauseButton.setText("►"); mediaPlayer.pause(); break; // If ready, paused or stopped, continue playing case READY: case PAUSED: case STOPPED: - pauseButton.setText("||"); mediaPlayer.play(); - if(mediaPlayer.getStatus() == Status.PAUSED) { - mediaPlayer.stop(); - setInfoLabelText("Playback error. File may be corrupted."); - } break; default: logger.log(Level.INFO, "MediaPlayer in unexpected state: " + status.toString()); // If the MediaPlayer is in an unexpected state, stop playback. - pauseButton.setText("►"); - mediaPlayer.pause(); + mediaPlayer.stop(); setInfoLabelText("Playback error."); break; } } }); + stopButton.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent e) { + mediaPlayer.stop(); + } + }); + progressSlider.valueProperty().addListener(new InvalidationListener() { @Override public void invalidated(Observable o) { @@ -483,19 +497,14 @@ public class FXVideoPanel extends MediaViewVideoPanel { } /** - * Toggle the availability of the progress slider and pause button. - * - * @param disable true to disable controls - * false to enable controls + * Reset the progress label and slider to zero. */ - private void disableControls(final boolean disable) { - Platform.runLater(new Runnable() { - @Override - public void run() { - pauseButton.setDisable(disable); - progressSlider.setDisable(disable); - } - }); + private void resetProgress() { + totalHours = 0; + totalMinutes = 0; + totalSeconds = 0; + progressSlider.setValue(0.0); + updateTime(Duration.ZERO); } /** @@ -514,6 +523,9 @@ public class FXVideoPanel extends MediaViewVideoPanel { MediaPlayerBuilder mediaPlayerBuilder = MediaPlayerBuilder.create(); mediaPlayerBuilder.media(media); mediaPlayerBuilder.onReady(READY_LISTENER); + mediaPlayerBuilder.onPaused(NOT_PLAY_LISTENER); + mediaPlayerBuilder.onStopped(NOT_PLAY_LISTENER); + mediaPlayerBuilder.onPlaying(PLAY_LISTENER); mediaPlayerBuilder.onEndOfMedia(END_LISTENER); MediaPlayer player = mediaPlayerBuilder.build(); @@ -538,7 +550,7 @@ public class FXVideoPanel extends MediaViewVideoPanel { */ private void updateSlider(Duration currentTime) { if (progressSlider != null) { - progressSlider.setDisable(duration.isUnknown()); + progressSlider.setDisable(currentTime.isUnknown()); if (!progressSlider.isDisabled() && duration.greaterThan(Duration.ZERO) && !progressSlider.isValueChanging()) { progressSlider.setValue(currentTime.divide(duration.toMillis()).toMillis() * 100.0); @@ -625,14 +637,14 @@ public class FXVideoPanel extends MediaViewVideoPanel { Duration beginning = mediaPlayer.getStartTime(); mediaPlayer.stop(); mediaPlayer.pause(); - pauseButton.setText("►"); + pauseButton.setText(PLAY_TEXT); updateSlider(beginning); updateTime(beginning); } } /** - * Responds changes in the MediaPlayer currentTime property. + * Responds to changes in the MediaPlayer currentTime property. * * Updates the progress slider and label with the current Time. */ @@ -643,6 +655,28 @@ public class FXVideoPanel extends MediaViewVideoPanel { updateTime(newValue); } } + + /** + * Triggered when MediaPlayer State changes to PAUSED or Stopped. + */ + private class NotPlayListener implements Runnable { + @Override + public void run() { + pauseButton.setText(PLAY_TEXT); + pauseButton.setStyle(PLAY_STYLE); + } + } + + /** + * Triggered when MediaPlayer State changes to PLAYING. + */ + private class PlayListener implements Runnable { + @Override + public void run() { + pauseButton.setText(PAUSE_TEXT); + pauseButton.setStyle(PAUSE_STYLE); + } + } } /** @@ -760,5 +794,4 @@ public class FXVideoPanel extends MediaViewVideoPanel { // return frames; // } // } - } diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/GstVideoPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/GstVideoPanel.java index 48e29a1970..955cc1a525 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/GstVideoPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/GstVideoPanel.java @@ -437,7 +437,7 @@ public class GstVideoPanel extends MediaViewVideoPanel { * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") - // + // //GEN-BEGIN:initComponents private void initComponents() { videoPanel = new javax.swing.JPanel(); @@ -562,6 +562,7 @@ public class GstVideoPanel extends MediaViewVideoPanel { private javax.swing.JSlider progressSlider; private javax.swing.JPanel videoPanel; // End of variables declaration//GEN-END:variables + private class VideoProgressWorker extends SwingWorker { private String durationFormat = "%02d:%02d:%02d/%02d:%02d:%02d "; @@ -769,4 +770,3 @@ public class GstVideoPanel extends MediaViewVideoPanel { } } } - diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/MediaViewImagePanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/MediaViewImagePanel.java index 04d8f458ee..bcaa1d280c 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/MediaViewImagePanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/MediaViewImagePanel.java @@ -32,7 +32,7 @@ import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.BorderPane; import javax.imageio.ImageIO; -import org.openide.modules.ModuleInstall; +import javax.swing.SwingUtilities; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.corelibs.ScalrWrapper; import org.sleuthkit.autopsy.coreutils.Logger; @@ -182,8 +182,13 @@ public class MediaViewImagePanel extends javax.swing.JPanel { fxPanel.setScene(fxScene); - //show the panel after fully loaded - fxPanel.setVisible(true); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + //show the panel after fully loaded + fxPanel.setVisible(true); + } + }); } }); diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractUSB.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractUSB.java index a224f286cf..ca5e5bfb6b 100644 --- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractUSB.java +++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractUSB.java @@ -36,6 +36,10 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; +/** + * Loads a file that maps USB IDs to names of makes and models. Uses Linux USB info. + * This should be renamed because it isn't extracting. It's just mapping IDs to names. + */ public class ExtractUSB { private static final Logger logger = Logger.getLogger(ExtractUSB.class.getName()); private HashMap devices; @@ -43,7 +47,7 @@ public class ExtractUSB { public ExtractUSB() { try { - devices(); + loadDeviceMap(); } catch (FileNotFoundException ex) { logger.log(Level.SEVERE, "Could not find file " + DataFile + ".", ex); devices = null; @@ -52,24 +56,39 @@ public class ExtractUSB { } } + /** + * Example inputs: + * Vid_XXXX&Pid_XXXX + * @param dev + * @return + */ public USBInfo get(String dev) { String[] dtokens = dev.split("[_&]"); - String mID = dtokens[1]; + String vID = dtokens[1]; String pID; if (dtokens.length < 4 || dtokens[3].length() < 4) { - pID = mID + "0000"; + pID = "0000"; } else { - pID = mID + dtokens[3]; + pID = dtokens[3]; } - if (!devices.containsKey(pID)) { + String key = vID + pID; + if (!devices.containsKey(key)) { return new USBInfo(null, null); } else { - return devices.get(pID); + return devices.get(key); } } - - private void devices() throws FileNotFoundException, IOException { + /** + * Reads the USB file. Syntax of file: + * + * # vendor vendor_name + * # device device_name <-- single tab + * # interface interface_name <-- two tabs + * @throws FileNotFoundException + * @throws IOException + */ + private void loadDeviceMap() throws FileNotFoundException, IOException { devices = new HashMap(); PlatformUtil.extractResourceToUserConfigDir(this.getClass(), DataFile); try (Scanner dat = new Scanner(new FileInputStream(new java.io.File(PlatformUtil.getUserConfigDirectory() + File.separator + "USB_DATA.txt")))) { @@ -84,7 +103,11 @@ public class ExtractUSB { } String pID = vID + "0000"; USBInfo info = new USBInfo(dvc, null); + + // make an entry with just the vendor ID devices.put(pID, info); + + // get the later lines that have specific products line = dat.nextLine(); if (line.startsWith("\t")) { while (dat.hasNext() && line.startsWith("\t")) { @@ -95,7 +118,9 @@ public class ExtractUSB { for (int n = 2; n < tokens.length; n++) { device += tokens[n] + " "; } + info = new USBInfo(dvc, device); + //make an entry where the key is both the vendor and product IDs concatenated devices.put(pID, info); } } diff --git a/build.xml b/build.xml index 917d26e76c..b6161a7c2c 100644 --- a/build.xml +++ b/build.xml @@ -239,7 +239,7 @@ - + diff --git a/installer_autopsy/installer_autopsy.aip b/installer_autopsy/installer_autopsy.aip old mode 100644 new mode 100755 index 01a5688229..fe79299c7d --- a/installer_autopsy/installer_autopsy.aip +++ b/installer_autopsy/installer_autopsy.aip @@ -1,11 +1,13 @@ - + + + - - + + @@ -79,15 +81,13 @@ - - - + @@ -95,15 +95,12 @@ - - - @@ -119,6 +116,5 @@ -