Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icoctl_readptr and readwrite_ptr macros. #965

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add icoctl_readptr and readwrite_ptr macros. #965

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 5, 2018

This macro is missing and are used when communicate with some USBFS ioctl commands in Linux. For example:

#define IOCTL_USBFS_IOCTL _IOWR('U', 18, struct usbfs_ioctl)

For details you may look at my experimental WIP usb rust driver at
https://gitlab.com/mike7b4/usbapi-rs where this macro is used...

@Susurrus Susurrus mentioned this pull request Nov 5, 2018
@Susurrus
Copy link
Contributor

Susurrus commented Nov 5, 2018

Failures at least partially resolved by #966.

@Susurrus
Copy link
Contributor

Susurrus commented Nov 5, 2018

It's not clear to me that either of these are actually needed. Could you provide some more information on what problems you ran into? My initial questions are:

  • For your ioctl_read_ptr example, why doesn't ioctl_read work?
  • For the readwrite ioctl (I'm referencing the Linux source here), why didn't you do ioctl_readwrite!(usbdevfs_ioctl, b'U', 18, usbdevfs_ioctl);? That should be correct.

bors bot added a commit that referenced this pull request Nov 5, 2018
966: Require Rust 1.24.1 r=asomers a=Susurrus

`lazy_static` as of 1.2 requires Rust 1.24.1, so make that our minimum required. This was discovered when I looked into the failures of #965.

@asomers if you agree with this change, could you update the buildbots here too?


Co-authored-by: Bryant Mairs <bryantmairs@google.com>
@ghost
Copy link
Author

ghost commented Nov 5, 2018

It's not clear to me that either of these are actually needed. Could you provide some more information on what problems you ran into? My initial questions are:

* For your `ioctl_read_ptr` example, why doesn't `ioctl_read` work?

* For the `readwrite` ioctl (I'm referencing the Linux source [here](https://github.com/torvalds/linux/blob/master/include/uapi/linux/usbdevice_fs.h#L185)), why didn't you do `ioctl_readwrite!(usbdevfs_ioctl, b'U', 18, usbdevfs_ioctl);`? That should be correct.

#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
this ioctl expect a pointer as third argument eg:

C:

{
    unsigned int claim = 0;
    ioctl(fd, USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int), &claim)
}

ioctl_read!(usb_claim_interface, b'U', 15, u32) translated to:

ioctl(fd, USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int), claim) reference.

same problem for readwrite!...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant