diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c
index ae76150e8ab82a1810286bead27f485242b5a42a..a9055e9eba23042ba5624cb16839d851f400b10a 100644
--- a/hw/xen/xen-common.c
+++ b/hw/xen/xen-common.c
@@ -38,7 +38,7 @@ static int store_dev_info(int domid, Chardev *cs, const char *string)
     int ret = -1;
 
     /* Only continue if we're talking to a pty. */
-    if (strncmp(cs->filename, "pty:", 4)) {
+    if (!CHARDEV_IS_PTY(cs)) {
         return 0;
     }
     pts = cs->filename + 4;