svn commit: r333989 - head/sys/dev/usb/template

Edward Tomasz Napierala trasz at FreeBSD.org
Mon May 21 17:33:54 UTC 2018


Author: trasz
Date: Mon May 21 17:33:52 2018
New Revision: 333989
URL: https://svnweb.freebsd.org/changeset/base/333989

Log:
  Add a somewhat ugly hack that makes OSX serial device node names
  human-readable.
  
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/usb/template/usb_template_modem.c
  head/sys/dev/usb/template/usb_template_multi.c
  head/sys/dev/usb/template/usb_template_serialnet.c

Modified: head/sys/dev/usb/template/usb_template_modem.c
==============================================================================
--- head/sys/dev/usb/template/usb_template_modem.c	Mon May 21 16:50:27 2018	(r333988)
+++ head/sys/dev/usb/template/usb_template_modem.c	Mon May 21 17:33:52 2018	(r333989)
@@ -81,7 +81,13 @@ enum {
 #define	MODEM_DEFAULT_INTERFACE		"Virtual serial port"
 #define	MODEM_DEFAULT_MANUFACTURER	USB_TEMPLATE_MANUFACTURER
 #define	MODEM_DEFAULT_PRODUCT		"Virtual serial port"
-#define	MODEM_DEFAULT_SERIAL_NUMBER	"March 2008"
+/*
+ * The reason for this being called like this is that OSX
+ * derives the device node name from it, resulting in a somewhat
+ * user-friendly "/dev/cu.usbmodemFreeBSD1".  And yes, the "1"
+ * needs to be there, otherwise OSX will mangle it.
+ */
+#define	MODEM_DEFAULT_SERIAL_NUMBER	"FreeBSD1"
 
 static struct usb_string_descriptor	modem_interface;
 static struct usb_string_descriptor	modem_manufacturer;

Modified: head/sys/dev/usb/template/usb_template_multi.c
==============================================================================
--- head/sys/dev/usb/template/usb_template_multi.c	Mon May 21 16:50:27 2018	(r333988)
+++ head/sys/dev/usb/template/usb_template_multi.c	Mon May 21 17:33:52 2018	(r333989)
@@ -99,7 +99,13 @@ enum {
 #define	MULTI_DEFAULT_CONFIGURATION	"Default configuration"
 #define	MULTI_DEFAULT_MANUFACTURER	USB_TEMPLATE_MANUFACTURER
 #define	MULTI_DEFAULT_PRODUCT		"Multifunction Device"
-#define	MULTI_DEFAULT_SERIAL_NUMBER	"May 2018"
+/*
+ * The reason for this being called like this is that OSX
+ * derives the device node name from it, resulting in a somewhat
+ * user-friendly "/dev/cu.usbmodemFreeBSD1".  And yes, the "1"
+ * needs to be there, otherwise OSX will mangle it.
+ */
+#define MULTI_DEFAULT_SERIAL_NUMBER	"FreeBSD1"
 
 static struct usb_string_descriptor	multi_modem;
 static struct usb_string_descriptor	multi_eth_mac;

Modified: head/sys/dev/usb/template/usb_template_serialnet.c
==============================================================================
--- head/sys/dev/usb/template/usb_template_serialnet.c	Mon May 21 16:50:27 2018	(r333988)
+++ head/sys/dev/usb/template/usb_template_serialnet.c	Mon May 21 17:33:52 2018	(r333989)
@@ -97,7 +97,13 @@ enum {
 #define	SERIALNET_DEFAULT_CONFIGURATION	"Default configuration"
 #define	SERIALNET_DEFAULT_MANUFACTURER	USB_TEMPLATE_MANUFACTURER
 #define	SERIALNET_DEFAULT_PRODUCT	"Serial/Ethernet device"
-#define	SERIALNET_DEFAULT_SERIAL_NUMBER	"January 2015"
+/*
+ * The reason for this being called like this is that OSX
+ * derives the device node name from it, resulting in a somewhat
+ * user-friendly "/dev/cu.usbmodemFreeBSD1".  And yes, the "1"
+ * needs to be there, otherwise OSX will mangle it.
+ */
+#define SERIALNET_DEFAULT_SERIAL_NUMBER	"FreeBSD1"
 
 static struct usb_string_descriptor	serialnet_modem;
 static struct usb_string_descriptor	serialnet_eth_mac;


More information about the svn-src-head mailing list