[OpenWrt-Devel] [PATCH 2/4] get buffer size from driver

John Crispin john at phrozen.org
Wed May 11 14:26:43 EDT 2016


Hi,

pulled the series into the umbim git just now. small issue inline

On 11/05/2016 13:24, Bjørn Mork wrote:
> Signed-off-by: Bjørn Mork <bjorn at mork.no>
> ---
>  mbim-dev.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/mbim-dev.c b/mbim-dev.c
> index 34bb2c228eb0..dd1110daeb52 100644
> --- a/mbim-dev.c
> +++ b/mbim-dev.c
> @@ -12,6 +12,8 @@
>   * GNU General Public License for more details.
>   */
>  
> +#include <linux/usb/cdc-wdm.h>

due to this a simple "cmake . && make" does not cut it anymore. we'll
need to tweak the CMakefile  to find the headers when compilig outside
the buildroot

	John

> +#include <sys/ioctl.h>
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  
> @@ -132,13 +134,20 @@ mbim_recv(struct uloop_fd *u, unsigned int events)
>  void
>  mbim_open(const char *path)
>  {
> +	__u16 max;
> +	int rc;
> +
>  	mbim_fd.cb = mbim_recv;
>  	mbim_fd.fd = open(path, O_RDWR);
>  	if (mbim_fd.fd < 1) {
>  		perror("open failed: ");
>  		exit(-1);
>  	}
> -	mbim_bufsize = MBIM_BUFFER_SIZE;
> +	rc = ioctl(mbim_fd.fd, IOCTL_WDM_MAX_COMMAND, &max);
> +	if (!rc)
> +		mbim_bufsize = max;
> +	else
> +		mbim_bufsize = 512;
>  	mbim_buffer = malloc(mbim_bufsize);
>  	uloop_fd_add(&mbim_fd, ULOOP_READ);
>  }
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list