-my $temperature_path = '/sys/devices/virtual/hwmon/hwmon0/temp1_input';
-my $critical_path = '/sys/devices/virtual/hwmon/hwmon0/temp1_crit';
+if (scalar @ARGV != 1 and (scalar @ARGV != 2 or not $ARGV[0] =~ /-[st]/)) {
+ print STDERR "Usage: $0 [-s | -t] <path/to/device>\n";
+ print STDERR "\n";
+ print STDERR "Normally this is /sys/devices/platform/*.\n";
+ exit 1;
+}
+if (scalar @ARGV == 1) {
+ @ARGV = ('', $ARGV[0]);
+}
+
+my $temperature_path = "$ARGV[1]/temp1_input";
+my $critical_path = "$ARGV[1]/temp1_crit";