+#ifdef LIBQMI_MBIM_PROXY
+static int
+mbim_send_proxy_msg(const char *path)
+{
+ struct mbim_proxy_control_configuration_s *p =
+ (struct mbim_proxy_control_configuration_s *) mbim_setup_command_msg(proxy_control,
+ MBIM_MESSAGE_COMMAND_TYPE_SET, MBIM_CMD_PROXY_CONTROL_CONFIGURATION,
+ sizeof(struct mbim_proxy_control_configuration_s));
+ mbim_encode_string(&p->devicepath, (char *)path);
+ p->timeout = htole32(30); // FIXME: hard coded timeout
+ return mbim_send_command_msg();
+}
+
+void
+mbim_proxy_open(const char *path)
+{
+ struct sockaddr_un addr = { .sun_family = AF_UNIX, .sun_path = "\0mbim-proxy" };
+
+ mbim_fd.cb = mbim_recv;
+ mbim_fd.fd = socket(PF_UNIX, SOCK_STREAM, 0);
+ if (mbim_fd.fd < 1) {
+ perror("socket failed: ");
+ exit(-1);
+ }
+ if (connect(mbim_fd.fd, (struct sockaddr *)&addr, 13)) {
+ perror("failed to connect to mbim-proxy: ");
+ exit(-1);
+ }
+ mbim_bufsize = 512; // FIXME
+ mbim_buffer = malloc(mbim_bufsize);
+ uloop_fd_add(&mbim_fd, ULOOP_READ);
+ no_close = 1;
+ mbim_send_proxy_msg(path);
+}
+#endif
+