Skip to content

fix: amend USBTMCCommonInterface to be os.O_RDWR in tmc in samps module#70

Merged
michealroberts merged 1 commit intomainfrom
fix/tmc/USBTMCCommonInterface/O_RDWR
Dec 2, 2025
Merged

fix: amend USBTMCCommonInterface to be os.O_RDWR in tmc in samps module#70
michealroberts merged 1 commit intomainfrom
fix/tmc/USBTMCCommonInterface/O_RDWR

Conversation

@michealroberts
Copy link
Owner

fix: amend USBTMCCommonInterface to be os.O_RDWR in tmc in samps module

fix: amend USBTMCCommonInterface to be os.O_RDWR in tmc in samps module
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the USBTMC device initialization by ensuring the timeout ioctl is properly executed during device opening. The key changes address a bug where the timeout was never actually set in the kernel driver during initialization.

  • Removed os.O_NONBLOCK flag since blocking mode with select() is the correct pattern for this implementation
  • Fixed timeout initialization by reordering the set_timeout() call to occur after _is_open = True, ensuring the kernel ioctl is actually executed
  • Changed error handling in set_timeout() to silently return on ENOTTY/EINVAL, allowing the code to gracefully handle PTYs and older kernels that don't support USBTMC timeout ioctls

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@michealroberts michealroberts merged commit b985c7d into main Dec 2, 2025
11 checks passed
@michealroberts michealroberts deleted the fix/tmc/USBTMCCommonInterface/O_RDWR branch December 2, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants