Results 1 to 4 of 4

Thread: Notification to the Qt application while USB plug/unplug

  1. #1
    Join Date
    Jul 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Notification to the Qt application while USB plug/unplug

    Hi All,

    I am working with Qt application handling usb devices on LInux os(3.1.0 kernel version) . I am able to interact with USB devices using Qt application with Libusb. But i am not able to communicate with usb device which is connected while Qt application is running(USB Hotplug).For interacting with new devices I am calling libusb api in every function then my application is able to communicate with new enumerated usb device also.

    Is there any other way to call it (libusb API ) while usb connecting and removing(when Qt application got notification ) instead of calling before every operation.

    Thanks & Regards
    Sreeram

  2. #2
    Join Date
    Jul 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Notification to the Qt application while USB plug/unplug

    Hi

    Any idea anyone ????


    Thanks
    Sreeram

  3. #3
    Join Date
    Jul 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Notification to the Qt application while USB plug/unplug

    Hi All

    Finally I have found some solution from internet regarding usb hotplug in Qt application.

    Code qdbus using udev:
    --------------------------------------
    QDBusConnection :: systemBus (). Connect (
    "Org.freedesktop.UDisks"
    "/ Org / freedesktop / UDisks",
    "Org.freedesktop.UDisks"
    "DeviceAdded"
    this, SLOT (deviceAdded (QDBusObjectPath));

    This I got from follwing link but I am not sure this will solve my qt application hotplug problem.

    http://idevlife.com/177851/

    If any one has idea on this QDbus please clarify How this function works in qt application, Then i can impliment this function in my qt application.

    I have two questios on this function->

    1.How this Qdbusconnection giving signal to Qt application when the usb device is plug/unplug
    2.To get usb plug/unplug notification we have to call this function or it will run call automaticall while usb plug or unplug.

    Please clarify to me above two questions then i can use code directly to my qt application.

    Thanks & Regards
    Sreeram
    Last edited by sreeram; 18th July 2013 at 12:22.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Notification to the Qt application while USB plug/unplug

    First, your initial question did not contain enough information for anyone to help you without wildly guessing
    Second, you complained about not getting a response within not even 5 hours of your first posting. That alone will make a lot of people just ignore you.

    Regarding the solution you found on the internet:
    QtDBus is a module in Qt that allows Qt programs to interact with the D-Bus message passing system. On Linux this is used for communication between processes of the same user session (so called session bus) and between system services and end user programs (so called system bus).

    The example you have is a usage of the second type, e.g. the program interacting with the UDev system service.

    The UDev system service seems to have a D-Bus API that emits a signal when a new device is attached. Using QtDBus you can map this signal to a Qt signal or, as in your example, connect it to a Qt slot.

    Cheers,
    _

Similar Threads

  1. Windows Shutdown Notification of Console Application
    By qtYoda in forum Qt Programming
    Replies: 5
    Last Post: 21st February 2012, 18:50
  2. How to detect monitor plug/unplug by using QT?
    By Kevin Hoang in forum Qt Programming
    Replies: 4
    Last Post: 21st September 2010, 17:44
  3. Replies: 7
    Last Post: 7th January 2010, 11:13
  4. Qt plug-in for GLib event loop based application
    By profoX in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2008, 15:27
  5. Application plug-in architecture
    By brcain in forum Qt Programming
    Replies: 3
    Last Post: 13th September 2006, 01:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.