Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6847273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:43:30+00:00 2026-05-27T00:43:30+00:00

I am trying to make a script (on linux) that can turn a light

  • 0

I am trying to make a script (on linux) that can turn a light in my mouse on or off.

This is the code I have so far:

import usb.core
import usb.util
import sys
interface = 0
dev = usb.core.find(idVendor=0x1532, idProduct=0x0017)

def main():

        if dev is None:
            print "device not found"

        else:
        print "device found"
        if dev.is_kernel_driver_active(interface) is True:
            print "but we need to detach kernel driver"
            dev.detach_kernel_driver(interface)
            print "claiming device"
            usb.util.claim_interface(dev, interface)


            print "release claimed interface"
            usb.util.release_interface(dev, interface)
            print "now attaching the kernel driver again"
            dev.attach_kernel_driver(interface)
            print "all done"
return 0

if __name__ == '__main__':
    main()

This works fine but if I try to do a: dev.set_configuration()

after the claim_interface(dev, interface)

the script returns the error: usb.core.USBError: Resource busy

Why is it still busy after I have detached its kernel driver?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:43:31+00:00Added an answer on May 27, 2026 at 12:43 am

    Not sure if this will solve, but are the udev rules for your mouse being set up correctly? I had a similar problem with a custom device a friend did for me and I solved by adding a rule like:

    SUBSYSTEM !="usb_device", ACTION !="add", GOTO="device_rules_end"
    SYSFS{idVendor} =="1532", SYSFS{idProduct} =="0017", SYMLINK+="mydevice"
    MODE="0666", OWNER="<your-username-here>", GROUP="root"
    LABEL="device_rules_end"
    

    in my /etc/udev/rules.d folder.

    HTH!

    EDIT: Before adding the rule, try running your script with sudo. If it will work that way it’s almost certainly a permission setting that will be fixed by the above rule.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a script that automatically starts uploading after the data has
I'm trying to make a script that will go into a directory and run
I have spent the whole day trying to make a script which on submit
I'm trying to make a PHP script, I have the script finished but it
I have been trying to make an init script using start-stop-daemon. I am stuck
I'm trying to make a PHP script that will take a potentially infinite number
I am trying to make a Postgres PHP backup script. I have downloaded one
I'm trying to make a script that listens to a variable (int or Number)
I am trying to make a script that when you type in a hex
I'm trying to make bash script that's a little bit too hard for me.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.